Hi,
Christophe Demarey had a nice idea (and he implemented it too!) that extends
the syntax (or more precisely, the usage of the syntax) of STON a bit, and I
just integrated it. Thank you, Christophe !
His core idea is to use the colon syntax for Associations. So now you can also
write:
#foo:1
which will become
#foo->1
and vice versa.
This does not change the way maps (either for dictionaries or arbitrary
objects) work. In practice, this means that there are now 2 closely related
expressions:
STON fromString: '[ #foo:1, #bar:2 ]'.
=> { #foo->1. #bar->2 }
STON fromString: '{ #foo:1, #bar:2 }'.
=> a Dictionary(#bar->2 #foo->1 )
In the first case you get an Array of explicit Associations, in the second case
you get a Dictionary which uses Associations internally, but that is an
implementation detail. And of course you can send #asDictionary to the array.
Note that nesting is also possible ;-)
#foo : 1 : 2
means
#foo->(1->2)
Anyway, I think from a Smalltalk perspective this is totally cool. As far as I
can see, this addition does not result in conflicts.
Another addition that was requested by Christophe that I added was a way to
control which instance variables get written and/or the order in which they get
written.
This can be done by overwriting Object class>>#stonAllInstVarNames
Sven