'From etoys2.1 of 26 July 2007 [latest update: #1528] on 7 August 2007 at 10:44:09 pm'! "Change Set: varNameFix-sw Date: 7 August 2007 Author: Scott Wallace Do not allow a system player-slot name to be used as a user-defined variable name."! !EToyVocabulary methodsFor: 'initialization' stamp: 'sw 8/7/2007 20:41'! systemSlotNames "Answer a list of the predefined system slots" ^ methodInterfaces select: [:m | m resultType ~= #unknown] thenCollect: [:m | Utilities inherentSelectorForGetter: m selector] " Vocabulary eToyVocabulary systemSlotNames "! ! !StandardScriptingSystem methodsFor: 'universal slots & scripts' stamp: 'sw 8/7/2007 22:40'! acceptableSlotNameFrom: originalString forSlotCurrentlyNamed: currentName asSlotNameIn: aPlayer world: aWorld "Produce an acceptable slot name, derived from the current name, for aPlayer. This method will always return a valid slot name that will be suitable for use in the given situation, though you might not like its beauty sometimes." | aString stemAndSuffix proscribed stem suffix putative | aString _ originalString asIdentifier: false. "get an identifier not lowercase" stemAndSuffix _ aString stemAndNumericSuffix. proscribed _ #(self super thisContext costume costumes dependents #true #false size), aPlayer class allInstVarNames, Vocabulary eToyVocabulary systemSlotNames. stem _ stemAndSuffix first. suffix _ stemAndSuffix last. putative _ aString asSymbol. [(putative ~~ currentName) and: [(proscribed includes: putative) or: [(aPlayer respondsTo: putative) or: [Smalltalk includesKey: putative]]]] whileTrue: [suffix _ suffix + 1. putative _ (stem, suffix printString) asSymbol]. ^ putative! !