Re: Literal instance slots, 10 foo := 1
On 2009-04-25, at 11:55 AM, Mike Austin wrote:
> In Io, I know it's possible to set a slot on a specific literal, for
> example:
>
> Io> 10 foo := 1
> ==> 1
> Io> 10 foo
> ==> 1
>> 20 foo
> Exception: Number does not respond to 'foo'
The caveat is that small numbers (IIRC -10 to 100) are global as a
performance optimization.
> 1. Does it introduce any overhead, or only when the first slot is set?
There's no special overhead.
> 2. Is there a good use for this functionality, other than being
> "correct"?
I would guess there are, though I haven't run across them.
- Steve