← index

Symbol

inherits Object

An interned identifier -- the type of #name literals (#'quoted form' for names with spaces or punctuation). Two symbols with the same name are the same object, so comparing them is a cheap identity check. Symbols name things -- selectors, classes, keys -- where a String would carry text.

#foo == #foo     "* -> true
#foo.s           "* -> foo

Instance methods

==:

Whether the argument is the same symbol. Symbols are interned, so this is an identity comparison; a non-Symbol is simply unequal.

#foo == #bar     "* -> false

native

asString

The name as a String -- the same text s returns.

native

asSymbol

The receiver itself: a Symbol is already a Symbol, so code can normalize a name-or-symbol value without checking its type first.

native

s

The plain name as a String, without the leading #.

#foo.s     "* -> foo

native