Wow, this thread came alive from the archive!
Note that I wasn't advocating for or against brace notation.
But, if you are trying to write code that is portable across Smalltalk dialects, you avoid brace notation.
On my projects, I would rather maintain: dictionary := Dictionary new at: $a put: 1; at: $b put: 2; at: $c put: 3; yourself.
than { $a -> 1. $b -> 2. $c -> 3 } asDictionary
As I think it would be easier to update. I use literal forms to save myself typing but when I commit code, I'd rather have the long form. In fact, I've sent #sourceString to literal arrays so I could get the long form without all the typing.
On 5/14/08, Jason Johnson jason.johnson.081@gmail.com wrote:
On Wed, Mar 5, 2008 at 10:23 PM, David Mitchell david.mitchell@gmail.com wrote:
Brace notation for dynamic arrays!
So instead of:
dictionary := { $a -> 1. $b -> 2. $c -> 3 } asDictionary.
I need to type:
dictionary := Dictionary new add: $a -> 1; add: $b -> 2; add: $c -> 3; yourself.
? In my opinion the other dialects should adopt this or propose another way of doing it. No concise syntax for dynamically creating a collection seems a problem to me, and easy to remedy in a language where one has access to the reader/compiler. So why would it be bad to do so?