Lox::StringObject
Inherits Lox::LoxObject < Reference < Object
We could probably just use Crystal's String type here instead. But this was a good first exercise in implementing LoxObjects.
Constructors
new(chars : Array(Char), hash : UInt64)
Sourcenew(chars : Array(Char))
SourceInstance methods
chars
Sourcehash
Generates an UInt64 hash value for this object.
This method must have the property that a == b implies a.hash == b.hash.
The hash value is used along with == by the Hash class to determine if two objects
reference the same hash key.
Subclasses must not override this method. Instead, they must define hash(hasher),
though usually the macro def_hash can be used to generate this method.
print_representation
Source