A Symbol is a lightweight constant identifier.
The Monkey C compiler will assign a new value when it encounters a new
Symbol. This allows a developer to use Symbol objects as keys or constant
values without explicitly declaring a
enum. While Symbol values are constant for a build, their
values may change across builds. For this reason, Symbol objects should not
be used for persistent data.
Instance Method Summary collapse
Methods inherited from
, , ,
Instance Method Details
Convert a Symbol to a Number
This will return a number containing the integer value of the symbol.
# File 'Monkeybrains.rb', line 6918 def toNumber() end
Convert a Symbol to a String
This will return the string for the name of the symbol in development builds. Because Monkey C does not contain runtime reflection information in release builds, the returned string will be different and will follow the format “symbol (num)”. In this format, “num” is the integer value of the symbol.
# File 'Monkeybrains.rb', line 6910 def toString() end