Arrays / collections with literal syntax - fixed size?

itsme213 itsme213 at hotmail.com
Sun Jan 6 19:31:13 UTC 2008


"nice" <ncellier at ifrance.com> wrote

> It's the fact that #(..) is a literal.
> And modifying a literal is a bad practice, whatever the language.
>
> However, { } is NOT a literal.

This seems like a reasonable argument for {...} to be a resizable 
collection, while [...] is not.

A related minor question: why does
    #(a b c)
print as
    #(#a #b #c)
If it is a literal the first seems a more minimal default.

Such syntax questions seem out of place in Smalltalk's minimalist 
philosophy. If they are not appropriate to this list, I apologize. I am 
relatively new to Squeak/ST (played on its periphery in the past) and know 
much of this is frozen, but to me a combination of some of:
 + ST keyword-message
 + some Ruby syntax conveniences ([],+,optional self...)
 + some form of namespaces (language or tool)
 + ST image and MC based development

would help light-weight DSL-ish usage a lot. Simply contrast:

  PWDisk on:
    (self data: theData
        footer: (OrderedCollection with: 1 with: 2))
vs.

  disk on: (data: theData footer: [1 2])

- Sophie 






More information about the Squeak-dev mailing list