Hi Sven, list, I'm using Pillar, and thus STON for its configuration file. And since I want users to change configuration files as they want, I wanted to add some comments explaining the meaning of the file fields. This raises the question: How can I write comments in a ston file? I was checking the STON reader and it looks like that is not supported. What should be a good comment format? { /* The site id is.... */ % comment line ## comment line -- comment line "siteid" : "" } Guille
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). I have to think about that. In any case, I think comments with open/close are generally more useful.
On 08 Jun 2015, at 16:12, Guillermo Polito <guillermopolito@gmail.com> wrote:
Hi Sven, list,
I'm using Pillar, and thus STON for its configuration file. And since I want users to change configuration files as they want, I wanted to add some comments explaining the meaning of the file fields.
This raises the question: How can I write comments in a ston file? I was checking the STON reader and it looks like that is not supported.
What should be a good comment format?
{ /* The site id is.... */ % comment line ## comment line -- comment line "siteid" : "" }
Guille
Sven Van Caekenberghe <sven@stfx.eu> 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. -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill
Le 8 juin 2015 à 17:03, Damien Cassou a écrit :
Sven Van Caekenberghe <sven@stfx.eu> 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.
+1 but it may outline that json/ston is not well suited to configuration files
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
If not we could maybe write a yaml parser :) http://yaml.org/ It has no brackets, it is also hierarchical and it supports comments. El lun., 8 de jun. de 2015 a la(s) 5:16 p. m., Sven Van Caekenberghe < sven@stfx.eu> escribió:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
so ugly! Le 8/6/15 17:27, Guillermo Polito a écrit :
If not we could maybe write a yaml parser :)
It has no brackets, it is also hierarchical and it supports comments.
El lun., 8 de jun. de 2015 a la(s) 5:16 p. m., Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> escribió:
> On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr <mailto:damien.cassou@inria.fr>> wrote: > > > Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> 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 >
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
Sven Van Caekenberghe <sven@stfx.eu> writes:
What do you think ?
this looks like a very good solution. Thank you very much Sven -- Damien Cassou http://damiencassou.seasidehosting.st "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill
You are up very early ;-) In #bleedingEdge (to be integrated in Pharo 5 later on): === Name: STON-Core-SvenVanCaekenberghe.60 Author: SvenVanCaekenberghe Time: 9 June 2015, 11:04:57.955405 am UUID: 7b95fcbe-1a44-4c94-a196-042e4cdb3e97 Ancestors: STON-Core-SvenVanCaekenberghe.59 Add 2 convenience methods: STON class>>#fromStringWithComments: STON class>>#fromStreamWithComments: Add more unit tests for the new functionality === Name: STON-Tests-SvenVanCaekenberghe.55 Author: SvenVanCaekenberghe Time: 9 June 2015, 11:05:12.121701 am UUID: 14ccb834-8db6-4577-aeb9-1bdd487c3ab8 Ancestors: STON-Tests-SvenVanCaekenberghe.54 Add 2 convenience methods: STON class>>#fromStringWithComments: STON class>>#fromStreamWithComments: Add more unit tests for the new functionality === So now you can write: STON fromStringWithComments: 'Point[/* this is X*/ 1, /* this is Y*/ 2] // Nice huh ?'. STON fromStringWithComments: '// Here is how you create a point: Point[ // this is X 1, // this is Y 2 ] // Nice huh ?'. The point of Richard is quite relevant though. Right now, the comments are literally filtered out and thrown away. Maybe you do not want that, and maybe you want to model the comments explicitly. A bit like: MyGreatAppConfig { #comment : 'This is a comment', #hostname : 'localhost', #port : 8080, #datasources : [ MyDataConfig { #comment : 'First datasource', #url: 'postgresql://blabla' }, MyDataConfig { #comment : 'Second datasource', #url: 'postgresql://blabla' } ] } This way, when you write out the config, the comments remain in place. Of course, the disadvantage is that people can only put comments in places where this is explicitly allowed. Sven
On 09 Jun 2015, at 05:33, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> writes:
What do you think ?
this looks like a very good solution.
Thank you very much Sven
-- Damien Cassou http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill
Cool! Actually I just wanted comments as a way of self documentation. So ignoring comments is more than enough for what I wanted :) Thanks! El mar., 9 de jun. de 2015 a la(s) 11:16 a. m., Sven Van Caekenberghe < sven@stfx.eu> escribió:
You are up very early ;-)
In #bleedingEdge (to be integrated in Pharo 5 later on):
=== Name: STON-Core-SvenVanCaekenberghe.60 Author: SvenVanCaekenberghe Time: 9 June 2015, 11:04:57.955405 am UUID: 7b95fcbe-1a44-4c94-a196-042e4cdb3e97 Ancestors: STON-Core-SvenVanCaekenberghe.59
Add 2 convenience methods:
STON class>>#fromStringWithComments: STON class>>#fromStreamWithComments:
Add more unit tests for the new functionality === Name: STON-Tests-SvenVanCaekenberghe.55 Author: SvenVanCaekenberghe Time: 9 June 2015, 11:05:12.121701 am UUID: 14ccb834-8db6-4577-aeb9-1bdd487c3ab8 Ancestors: STON-Tests-SvenVanCaekenberghe.54
Add 2 convenience methods:
STON class>>#fromStringWithComments: STON class>>#fromStreamWithComments:
Add more unit tests for the new functionality ===
So now you can write:
STON fromStringWithComments: 'Point[/* this is X*/ 1, /* this is Y*/ 2] // Nice huh ?'.
STON fromStringWithComments: '// Here is how you create a point: Point[ // this is X 1, // this is Y 2 ] // Nice huh ?'.
The point of Richard is quite relevant though. Right now, the comments are literally filtered out and thrown away. Maybe you do not want that, and maybe you want to model the comments explicitly. A bit like:
MyGreatAppConfig { #comment : 'This is a comment', #hostname : 'localhost', #port : 8080, #datasources : [ MyDataConfig { #comment : 'First datasource', #url: 'postgresql://blabla' }, MyDataConfig { #comment : 'Second datasource', #url: 'postgresql://blabla' } ] }
This way, when you write out the config, the comments remain in place. Of course, the disadvantage is that people can only put comments in places where this is explicitly allowed.
Sven
On 09 Jun 2015, at 05:33, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> writes:
What do you think ?
this looks like a very good solution.
Thank you very much Sven
-- Damien Cassou http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill
I will update the STON chapter :) 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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
Where exactly can I find what you changed ? I don't see any commit of you on github ...
On 09 Jun 2015, at 20:10, stepharo <stepharo@free.fr> wrote:
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
This is in the entreprise book. I added a subsection on comments. May be I committed but forgot to push. Now I did it. Stef Le 9/6/15 21:50, Sven Van Caekenberghe a écrit :
Where exactly can I find what you changed ? I don't see any commit of you on github ...
On 09 Jun 2015, at 20:10, stepharo <stepharo@free.fr> wrote:
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
On 10 Jun 2015, at 15:13, stepharo <stepharo@free.fr> wrote:
This is in the entreprise book. I added a subsection on comments. May be I committed but forgot to push. Now I did it.
And now I see it. I made a small change.
Stef
Le 9/6/15 21:50, Sven Van Caekenberghe a écrit :
Where exactly can I find what you changed ? I don't see any commit of you on github ...
On 09 Jun 2015, at 20:10, stepharo <stepharo@free.fr> wrote:
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
Le 10/6/15 20:39, Sven Van Caekenberghe a écrit :
On 10 Jun 2015, at 15:13, stepharo <stepharo@free.fr> wrote:
This is in the entreprise book. I added a subsection on comments. May be I committed but forgot to push. Now I did it. And now I see it. I made a small change. super!
Stef
Le 9/6/15 21:50, Sven Van Caekenberghe a écrit :
Where exactly can I find what you changed ? I don't see any commit of you on github ...
On 09 Jun 2015, at 20:10, stepharo <stepharo@free.fr> wrote:
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
Hi Sven! I'm finally using the new STON with comments and I found one little problem: my ston file has urls :/ { // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" } That is, doing: STON fromStreamWithComments: '{ // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" }' readStream Will fail with an invalid input error because after skipping comments my STON stream remains like STON fromStreamWithComments: '{ "aURL": "http: } Any thoughts? Guille El dom., 14 de jun. de 2015 a la(s) 3:06 a. m., stepharo <stepharo@free.fr> escribió:
Le 10/6/15 20:39, Sven Van Caekenberghe a écrit :
On 10 Jun 2015, at 15:13, stepharo <stepharo@free.fr> wrote:
This is in the entreprise book. I added a subsection on comments. May be I committed but forgot to push. Now I did it. And now I see it. I made a small change. super!
Stef
Le 9/6/15 21:50, Sven Van Caekenberghe a écrit :
Where exactly can I find what you changed ? I don't see any commit of you on github ...
On 09 Jun 2015, at 20:10, stepharo <stepharo@free.fr> wrote:
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
Guille, I understand the problem. The reason is that STONCStyleCommentsSkipStream was/is a quick hack and does not know/understand anything about strings. It seems that the C preprocessor ignores comments in C strings, so we could consider adding that. Basically STONCStyleCommentsSkipStream>>#nextNonCommentChar should know when it is inside a string and then ignore comments. But that means, in the case of STON/JSON, handling both ' (single) and " (double) quoted strings as well as interpret \' and \". All this should be doable, but it is not that easy to do elegantly. I'll see what I can do. Sven
On 16 Jul 2015, at 17:35, Guillermo Polito <guillermopolito@gmail.com> wrote:
Hi Sven!
I'm finally using the new STON with comments and I found one little problem: my ston file has urls :/
{ // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" }
That is, doing:
STON fromStreamWithComments: '{ // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" }' readStream
Will fail with an invalid input error because after skipping comments my STON stream remains like
STON fromStreamWithComments: '{ "aURL": "http: }
Any thoughts? Guille
El dom., 14 de jun. de 2015 a la(s) 3:06 a. m., stepharo <stepharo@free.fr> escribió:
Le 10/6/15 20:39, Sven Van Caekenberghe a écrit :
On 10 Jun 2015, at 15:13, stepharo <stepharo@free.fr> wrote:
This is in the entreprise book. I added a subsection on comments. May be I committed but forgot to push. Now I did it. And now I see it. I made a small change. super!
Stef
Le 9/6/15 21:50, Sven Van Caekenberghe a écrit :
Where exactly can I find what you changed ? I don't see any commit of you on github ...
On 09 Jun 2015, at 20:10, stepharo <stepharo@free.fr> wrote:
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
Hi sven Le 16/7/15 21:28, Sven Van Caekenberghe a écrit :
Guille,
I understand the problem.
The reason is that STONCStyleCommentsSkipStream was/is a quick hack and does not know/understand anything about strings.
It seems that the C preprocessor ignores comments in C strings, so we could consider adding that. What is the C preprocessor.
Basically STONCStyleCommentsSkipStream>>#nextNonCommentChar should know when it is inside a string and then ignore comments. But that means, in the case of STON/JSON, handling both ' (single) and " (double) quoted strings as well as interpret \' and \". All this should be doable, but it is not that easy to do elegantly. I'll see what I can do.
Sven
On 16 Jul 2015, at 17:35, Guillermo Polito <guillermopolito@gmail.com> wrote:
Hi Sven!
I'm finally using the new STON with comments and I found one little problem: my ston file has urls :/
{ // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" }
That is, doing:
STON fromStreamWithComments: '{ // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" }' readStream
Will fail with an invalid input error because after skipping comments my STON stream remains like
STON fromStreamWithComments: '{ "aURL": "http: }
Any thoughts? Guille
El dom., 14 de jun. de 2015 a la(s) 3:06 a. m., stepharo <stepharo@free.fr> escribió:
Le 10/6/15 20:39, Sven Van Caekenberghe a écrit :
On 10 Jun 2015, at 15:13, stepharo <stepharo@free.fr> wrote:
This is in the entreprise book. I added a subsection on comments. May be I committed but forgot to push. Now I did it. And now I see it. I made a small change. super!
Stef
Le 9/6/15 21:50, Sven Van Caekenberghe a écrit :
Where exactly can I find what you changed ? I don't see any commit of you on github ...
On 09 Jun 2015, at 20:10, stepharo <stepharo@free.fr> wrote:
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
On 17 Jul 2015, at 09:00, stepharo <stepharo@free.fr> wrote:
Hi sven
Le 16/7/15 21:28, Sven Van Caekenberghe a écrit :
Guille,
I understand the problem.
The reason is that STONCStyleCommentsSkipStream was/is a quick hack and does not know/understand anything about strings.
It seems that the C preprocessor ignores comments in C strings, so we could consider adding that. What is the C preprocessor.
STONCStyleCommentsSkipStream was modelled (in concept) after the C preprocessor, cpp, https://en.wikipedia.org/wiki/C_preprocessor
Basically STONCStyleCommentsSkipStream>>#nextNonCommentChar should know when it is inside a string and then ignore comments. But that means, in the case of STON/JSON, handling both ' (single) and " (double) quoted strings as well as interpret \' and \". All this should be doable, but it is not that easy to do elegantly. I'll see what I can do.
Sven
On 16 Jul 2015, at 17:35, Guillermo Polito <guillermopolito@gmail.com> wrote:
Hi Sven!
I'm finally using the new STON with comments and I found one little problem: my ston file has urls :/
{ // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" }
That is, doing:
STON fromStreamWithComments: '{ // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" }' readStream
Will fail with an invalid input error because after skipping comments my STON stream remains like
STON fromStreamWithComments: '{ "aURL": "http: }
Any thoughts? Guille
El dom., 14 de jun. de 2015 a la(s) 3:06 a. m., stepharo <stepharo@free.fr> escribió:
Le 10/6/15 20:39, Sven Van Caekenberghe a écrit :
On 10 Jun 2015, at 15:13, stepharo <stepharo@free.fr> wrote:
This is in the entreprise book. I added a subsection on comments. May be I committed but forgot to push. Now I did it. And now I see it. I made a small change. super!
Stef
Le 9/6/15 21:50, Sven Van Caekenberghe a écrit :
Where exactly can I find what you changed ? I don't see any commit of you on github ...
On 09 Jun 2015, at 20:10, stepharo <stepharo@free.fr> wrote:
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
On 16 Jul 2015, at 21:28, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Guille,
I understand the problem.
The reason is that STONCStyleCommentsSkipStream was/is a quick hack and does not know/understand anything about strings.
It seems that the C preprocessor ignores comments in C strings, so we could consider adding that.
Basically STONCStyleCommentsSkipStream>>#nextNonCommentChar should know when it is inside a string and then ignore comments. But that means, in the case of STON/JSON, handling both ' (single) and " (double) quoted strings as well as interpret \' and \". All this should be doable, but it is not that easy to do elegantly. I'll see what I can do.
=== Name: STON-Core-SvenVanCaekenberghe.62 Author: SvenVanCaekenberghe Time: 17 July 2015, 7:50:06.278051 pm UUID: 949e54c8-9da8-4e91-ab44-55105bff349c Ancestors: STON-Core-SvenVanCaekenberghe.61 Added new STONCStyleCommentsSkipStream feature: Comments inside single and double quote delimited strings are ignored. Backslash escapes for single and double quotes inside strings are honored. === Name: STON-Tests-SvenVanCaekenberghe.57 Author: SvenVanCaekenberghe Time: 17 July 2015, 7:50:38.683873 pm UUID: ad125293-a41b-45a6-a0fe-016dd5e02f7b Ancestors: STON-Tests-SvenVanCaekenberghe.56 Added new STONCStyleCommentsSkipStream feature: Comments inside single and double quote delimited strings are ignored. Backslash escapes for single and double quotes inside strings are honored. === Now you can do: testCommentInString self assert: (STONCStyleCommentsSkipStream on: '''/*comment*/''' readStream) upToEnd equals: '''/*comment*/'''. self assert: (STONCStyleCommentsSkipStream on: '{''foo'':''/*comment*/bar''}' readStream) upToEnd equals: '{''foo'':''/*comment*/bar''}'. self assert: (STONCStyleCommentsSkipStream on: '{''foo'':''//comment\''bar''}' readStream) upToEnd equals: '{''foo'':''//comment\''bar''}'. self assert: (STONCStyleCommentsSkipStream on: '{"foo":"/*comment*/bar"}' readStream) upToEnd equals: '{"foo":"/*comment*/bar"}'. self assert: (STONCStyleCommentsSkipStream on: '{"foo":"//comment\"bar"}' readStream) upToEnd equals: '{"foo":"//comment\"bar"}'
Sven
On 16 Jul 2015, at 17:35, Guillermo Polito <guillermopolito@gmail.com> wrote:
Hi Sven!
I'm finally using the new STON with comments and I found one little problem: my ston file has urls :/
{ // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" }
That is, doing:
STON fromStreamWithComments: '{ // comment ok, skipped /* comment ok, skipped */ "aURL": "http://ouch.it.will.be.skipped/and/break?my=ston" }' readStream
Will fail with an invalid input error because after skipping comments my STON stream remains like
STON fromStreamWithComments: '{ "aURL": "http: }
Any thoughts? Guille
El dom., 14 de jun. de 2015 a la(s) 3:06 a. m., stepharo <stepharo@free.fr> escribió:
Le 10/6/15 20:39, Sven Van Caekenberghe a écrit :
On 10 Jun 2015, at 15:13, stepharo <stepharo@free.fr> wrote:
This is in the entreprise book. I added a subsection on comments. May be I committed but forgot to push. Now I did it. And now I see it. I made a small change. super!
Stef
Le 9/6/15 21:50, Sven Van Caekenberghe a écrit :
Where exactly can I find what you changed ? I don't see any commit of you on github ...
On 09 Jun 2015, at 20:10, stepharo <stepharo@free.fr> wrote:
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 <sven@stfx.eu> wrote:
On 08 Jun 2015, at 17:03, Damien Cassou <damien.cassou@inria.fr> wrote:
Sven Van Caekenberghe <sven@stfx.eu> 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
Damien Cassou-2 wrote
Sven Van Caekenberghe <
sven@
> 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 think you may have combined two requirements and come up with a "I can adapt this existing idea to handle both" solution. In my experience, I would suggest the word "adapt" in that phrase /usually ends up/ being better read as "pervert". So, let's step back for a moment and start by clearly and precisely identifying the actual requirements. As I interpret the foregoing discussion, there are two. 1) We want the ability to include information in a configuration which can be used to document, explain, guide those who come after. 2) We want to provide a template configuration that will make it easier for people to figure out how to create a good configuration. I will also remind everyone of one thing that seems to be a fundamentally important aspect of Smalltalk programming: we prefer code over comments. For example, I came across some unit tests which included comments like "The result should be blah". Generally, we would write that as "self assert: result equals: blah". So, let's add this requirement: 3) The best implementation of a "spec" like a configuration will maximize the DSL capability of Smalltalk. In my opinion, none of these requirements are well satisfied by adding comments to the STON syntax. The first requirement, again in my opinion, is best handled by modelling a narrative aspect in configurations. I'm not suggestion how that should be done nor what to call it. The second requirement seems best satisfied by providing a template configuration file with the its various aspects specified by some example content that clearly illustrates the right way to do it. And the third requirement is satisfied when the modelling of the configuration formalizes what it is we want it to convey.
-- Damien Cassou http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill
-- View this message in context: http://forum.world.st/Comments-in-STON-tp4830944p4830990.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (6)
-
Christophe Demarey -
Damien Cassou -
Guillermo Polito -
Richard Sargent -
stepharo -
Sven Van Caekenberghe