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