On 19 October 2012 16:31, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi Igor,
This is a very nice and elegant expression (of a variation) of the Array literal idea. Thanks a lot for taking the effort to implement and share it.
I think that a formal specification and a standalone parser that does not depend on the builtin compiler is also needed. That would mean that we have to define all primitive types. Minimally I can see these:
- nil - Boolean - Integer - Symbol - Float - String
What with escaping unprintable characters ?
well, this is easy: implement String>>asObjectLiteral to answer 'escaped representation of string' and String>>fromObjectLiteral to unescape it back. so, you probably won't need to bother with escaping in parser (parser will parse human-readable chars)
What with complex symbols ?
like what?
What with fractions ?
just implement conversion methods for it and that's it
What with human readable/writeable representations for Date, Time, DateAndTime ?
same story :)
The classnames currently match one-to-one to classes, in the light of cross dialect compatibility and namespaces a mapping might be needed.
yeah.. but that's not a big deal , right? you can always replace "Smalltalk at: symbol " with something like "Smalltalk at: (ObjectLiteralMapping of: symbol)" or whatever :) and, of course if no class found, you can still play nicely, i.e.: (Smalltalk at: classname ifAbsent: [ ^ ObjectLiteralNoMapping for: literal ] ) (see the implementation of Array>>fromObjectLiteral)
Sven
PS: provided we can agree and formally define the above, I might be interested in trying to write a parser ;-)
:) -- Best regards, Igor Stasenko.