Le 9/6/15 20:06, stepharo a écrit :
I will update the STON chapter :)

Done :)



Le 8/6/15 23:39, Sven Van Caekenberghe a écrit :
I would do it like this: use a wrapping stream to skip comments.

===
Name: STON-Core-SvenVanCaekenberghe.59
Author: SvenVanCaekenberghe
Time: 8 June 2015, 11:34:32.886167 pm
UUID: 7ab942b5-9d1a-44c3-9d58-da29feb72380
Ancestors: STON-Core-SvenVanCaekenberghe.58

Add experimental STONCStyleCommentsSkipStream and tests
===
Name: STON-Tests-SvenVanCaekenberghe.54
Author: SvenVanCaekenberghe
Time: 8 June 2015, 11:34:52.918771 pm
UUID: 3dcb2c9c-6efe-4d62-bf36-3bbe91f09d08
Ancestors: STON-Tests-SvenVanCaekenberghe.53

Add experimental STONCStyleCommentsSkipStream and tests
===

Then you can do as follows:

STON fromStream: (STONCStyleCommentsSkipStream on: 'Point[/* this is X*/ 1, /* this is Y*/ 2] // Nice huh ?' readStream).

    => 1@2

STON fromStream: (STONCStyleCommentsSkipStream on: '// Here is how you create a point:
Point[
    // this is X
    1,
    // this is Y
    2 ]
// Nice huh ?' readStream).

    => 1@2

This helper class would be useable in other contexts too (like NeoJSON).

The advantage is that it does not change the STON (or JSON) syntax itself, it just add some functionality for those who want it.

What do you think ?

Sven

PS: this probably needs some more testing

On 08 Jun 2015, at 17:16, Sven Van Caekenberghe <[email protected]> wrote:

On 08 Jun 2015, at 17:03, Damien Cassou <[email protected]> wrote:


Sven Van Caekenberghe <[email protected]> writes:

I am not so sure we should add that.

The JSON spec explicitly does not allow comments because of fear of abuse (that the comments would be used to add semantic meaning outside the spec).

really? That's surprising. Comments in configuration files are very
important. Even more when the configuration files are templates for new
users.
I know some people are using STON in ways that I did not originally anticipate, that is of course cool, but writing configuration files was not the original goal. STON is a version of JSON that is closer to our object model.

Like I said, I will think about it.

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill







Reply via email to