Hi Thierry,

It is good to discuss about this. But note that the ObjectLiterals idea is not 
mine, it is from Stef/Igor. My contribution was to quickly create a separate 
project for it and add a true parser (from textual input).

A design for a serialisation format, like JSON, STON, FUEL and ObjectLiterals 
is always a compromise between different aspect (well any design is), with 
specific goals in mind.

I think I more or less understand what you suggest, but I guess that would make 
things more complex - but that is just my initial opinion/reaction.

The Array special case is related to the already existing 

Sven

On 29 Aug 2014, at 11:53, Thierry Goubier <[email protected]> wrote:

> Hi Sven,
> 
> have you looked into some of the alternatives such as the ones I saw when 
> porting Dolphin code to Pharo?
> 
> Nominally the ##( ) (force evaluation of inside Smalltalk code) and [ ] once ?
> 
> Regarding your proposal, I'm a bit worried about the logic of scanning for 
> class names. How can I ensure that:
> 
> #(Array 1) is the same as #(#Array 1) ?

Because #() is a literal array that sees only the Symbol not the Class ?

I mean, it is not { Array. 1 } is it ?

> Thierry
> 
> 2014-08-29 11:35 GMT+02:00 stepharo <[email protected]>:
> Hi guys
> 
> we are looking at STON and ObjectLiterals with Christophe and for handling 
> metadata.
> 
> 
> And I was brainstorming.... I was wondering if it would be possible to have a 
> bit more use of self evaluating
> 
> for example
>     1@3
>     #k -> 2 instead of (Association #k 123)
> 
> 
> my brainstorming is how could we minimize new syntactic constructs and still 
> support a literal object format.
> So object literal cover that so may be this is good.
> 
>     1@3 as (Point 1 3)
>     and
>     #k -> 123 as (Association #k 123)
> 
> So I'm not clear but this is interesting to think about it.
> I would like to have also a dictionary literal syntax.... but this another 
> story.
> 
> Stef
> 
> PS: Sven I added support for Association into the ObjectLiteral project to 
> see how it works.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I took Igor's initial code and created a new project:
> 
>     http://smalltalkhub.com/#!/~SvenVanCaekenberghe/ObjectLiterals/
> 
> and I added ObjectLiteralParser to convert any Character Stream or String 
> into a Smalltalk Literal Array and eventually into an Object.
> 
> This proof of concept moves the ObjectLiteral format/notation away from the 
> Smalltalk compiler and will help us discuss more concretely the actual 
> details of the specification (which is still not 100% finished).
> 
> I also added 12 unit tests and cleaned up the code and comments.
> 
> Please have a look at the code.
> 
> This is one of the tests:
> 
> ObjectLiteralParserTests>>#testMixed1
>     | input output |
>     input := '
>         #(Array
>             1
>             foo
>             #''foo-#bar''
>             true
>             false
>             nil
>             3.14159
>             -100
>             ''string''
>             (#OrderedCollection 7 8 9)
>             #(Set 10)
>             (Dictionary
>                 x 1
>                 y 2) )  '.
>      output := {
>         1.
>         #foo.
>         #'foo-#bar'.
>         true.
>         false.
>         nil.
>         3.14159.
>         -100.
>         'string'.
>         OrderedCollection withAll: #(7 8 9).
>         Set with: 10.
>         Dictionary newFromPairs: #(x 1 y 2 ). }.
>     self assert: (self parserOn: input) nextObjectLiteral equals: output
> 
> I like this format, its simplicity and elegance is appealing, it offers 
> distinctive advantages in the Smalltalk context while its slight readability 
> disadvantage is acceptable. Like any format it is a compromise and a 
> tradeoff, but a rather good one.
> 
> 
> 
> 
>  
> 
> Regards,
> 
> Sven
> 
> --
> Sven Van Caekenberghe
> http://stfx.eu
> Smalltalk is the Red Pill
> 
> 
> 


Reply via email to