Arrays / collections with literal syntax - fixed size?

Randal L. Schwartz merlyn at stonehenge.com
Sun Jan 6 00:18:21 UTC 2008


>>>>> "itsme213" == itsme213  <itsme213 at hotmail.com> writes:

itsme213> Are #(...) and {...} the only 2 short, non-message-passing syntaxes
itsme213> for creating collections?

For compiling collections, yes.

itsme213> They both seem to yield Array, which apparently has a fixed
itsme213> size.

Yes, because those can't change during compilation.

itsme213>  I'm curious about why the only (I think) convenient syntax for
itsme213> simple collection usage has this restriction on what you can do with
itsme213> it.

Sent it an "as:" to change its shape:

  #(2 3 5 7) as: Set

itsme213> And as far as I can tell, there is no similar convenient syntax for 
itsme213> dictionaries. Is that true?

  { #dog -> 'bark' . #cat -> 'meow' } as: Dictionary

Browse the Collection hierarchies from time to time.  Lots of good stuff in
there.  In your case, look at the "converting" protocols, and implementors
of #newFrom: (which #as: uses).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



More information about the Squeak-dev mailing list