Login  Register

Re: Help on operators in Dolphin

Posted by Sean M-4 on Dec 22, 2005; 9:52am
URL: https://forum.world.st/Help-on-operators-in-Dolphin-tp3377011p3377015.html

> Is there any ware in Help a details explanation of special operators
> and symbols. eg / // # ## ^ etc (I know some but not all of the uses)?

#(self) creates a literal array with the literal symbol #self as the single
element.

However, ##(self) is sort of like, a compile time inline. Basically the
message/object gets evaluated at compile time rather than runtime. so you
can do something like:

| secondsInAWeek |
secondsInAWeek := ##(60 * 60 * 24 * 7).

And instead of being evaluated every time the message it is contained within
is invoked, it is evaluated once, at compile time, so the actual bytecode
that is generated, is the same as if you had used a magic number constant
like so:

| secondsInAWeek |
secondsInAWeek := 604800.

##() doesn't work in a workspace, only in compiled methods.