[squeak-dev] Immediate array of objects?

Eliot Miranda eliot.miranda at gmail.com
Thu Jan 5 04:59:40 UTC 2023



> On Jan 4, 2023, at 8:04 AM, Stephen Travis Pope <stephen at heaveneverywhere.com> wrote:
> 
> 
> 
> Hello all,
> 
> Has the interpretation of immediate arrays, i.e., #(obj1 obj2) changed?

BTW, the correct terminology is “literal arrays”. “Immediate” is used to describe instances of SmallInteger, Character, and SmallFloat64, which are encoded directly in a tagged pointer, i.e. there is no “box” fir the object.

There was a change in the compilation of literal arrays from Smalltalk-80 v2 (blue book) to (a little before) the ANSI standard. Before, any unquoted string was interpreted as a Symbol, so #(nil true false) collect: [:t| t class] answered Array with: Symbol with: Symbol with: Symbol. The change was to interpret exactly these three unquoted strings as referring to the objects nil, true, and false. So now #(nil true false) collect: [:t| t class] answers {UndefinedObject. True. False}.

> I have loads of code (from ST80) that creates arrays of intervals like,
> 
> 			 #((80 to: 90) (60 to: 70))
> 
> where what I want is,
> 
> 			(Array with: (80 to: 90) with: (60 to: 70))
> 
> but Squeak reads this as,
> 
> 			ampl: #(#(80 #to: 90) #(60 #to: 70))
> 
> Am I missing something?
> 
> stp
> 
> --------
> 
> Stephen Travis Pope    Ojai, California, USA
>     
>      http://HeavenEverywhere.com
>      http://FASTLabInc.com
>      https://vimeo.com/user19434036/videos
>      http://heaveneverywhere.com/Reflections
> 
> 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230104/cea0effc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic.tiff
Type: image/tiff
Size: 2442 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230104/cea0effc/attachment.tiff>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230104/cea0effc/attachment-0001.html>


More information about the Squeak-dev mailing list