Identifiers
Last updated at 4:38 pm UTC on 27 August 2005
Identifiers are used to name entities like variables, classes, and message selectors.
- The first character must be a letter (or the identifier is the name of a binary method like + - // \\ @@ etc.)
- The remaining characters may be any combination of letters and digits
- Upper and lower case letters are distinguished
Conventions are that class names and class variables are CapitalizedLikeThis, while instance vars, message selectors, local variables and arguments areStartingWithALowerCaseLetterLikeThis.
Internally identifiers er represented by symbols, which in turn means that you can use symbols when asking about messages or variables, for example:
anObject respondsTo: #aMethod ifTrue: [ anObject aMethod ]
ifFalse: [ Transcript show 'Sorry, the object does not understand the method aMethod' ; cr ].
And these two lines do the same thing:
Transcript perform: #show: with: ('popillol' perform: #reverse).
Transcript show: ('popillol' reverse).