Why #method? WAS "Re: [Newbies] Multiple constructors"

Ralph Johnson johnson at cs.uiuc.edu
Fri May 12 23:19:04 UTC 2006

On 5/12/06, Bob Erb <bob.erb at gmail.com> wrote:
> Here's a question I feel comfortable asking on the Newbies list. :-)
> What's the hash mark signify when used as a prefix to a method
> name,

The hash mark signifies that it is a symbol.

Another word for "method name" is "selector".  You sometimes see this
in comments in the code.  For example, see the method
#addSelector:withMethod: in Behavior.  A "selector" is always a
symbol.  This means that the name of a method is always a symbol.

If I were writing a paper on Smalltalk and wanted to mention a method
name, I'd probably make it bold face, but when I am using plain ASCII,
like in e-mail or a Smalltalk comment, I'll put a hash mark before the
method name to indicate that it is a symbol.

-Ralph Johnson

More information about the Beginners mailing list