[squeak-dev] Pool dictionary entries and array shorthand

Frank Shearar frank.shearar at gmail.com
Tue Mar 5 19:33:33 UTC 2013


On 5 March 2013 19:17, Louis LaBrunda <Lou at keystone-software.com> wrote:
> Hi,
>
> I'm sure we have all used the array creation shorthand: #(5 4 3 2 1).  When
> trying to create an array with elements of a pool dictionary like:
> #(BlueWool LimeWool) one ends up with an array of the symbolic names of the
> pool dictionary entries and not their values: #(#BlueWool #LimeWool).
>
> IMHO this is almost useless.  If I wanted the symbols in an array I would
> just use: #(#BlueWool #LimeWool) which looks like what was wanted and isn't
> much more to type.  I think the values is what one would expect from:
> #(BlueWool LimeWool) and not the symbols and I don't see any other
> shorthand way to get them.

a := 1.
b := 2.
{a. b.} == Array with: a with: b

#() array literals have their uses because they're _compile-time_
calculated. A method that uses them won't pay the cost of creating the
array on every invocation.

frank

> VA Smalltalk works the same way.  I don't know about any other Smalltalk.
> Both Smalltalks pretty print it the same way they do with any other pool
> dictionary usage.
>
> I don't want to go so far as to call this a bug but I'm close.  I don't see
> why one would want it to work this way and I can see great value in
> building the array with the pool values.  Can we get this changed?  Does
> anyone depend on the current implementation?
>
> Lou
> -----------------------------------------------------------
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
> mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com
>
>


More information about the Squeak-dev mailing list