[squeak-dev] Re: Deltastreams update

Igor Stasenko siguctua at gmail.com
Fri Mar 13 02:23:40 UTC 2009


2009/3/13 Nicolas Cellier <ncellier at ifrance.com>:
> Göran Krampe <goran <at> krampe.se> writes:
>
>>
>> Mmmmmm, you mean for example in an array like:
>>
>> {"delta": {
>>     "method-source-change": {
>>         "class" : "SomeClass",
>>         "protocol": "some-method-category",
>>         "stamp" : "elder 3/21/1996 12:34",
>>         "source": [
>>             "method line one with a \"comment\" in it.",
>>             "method line two with two tabs: \t\t",
>>             "method line three",
>>             "method line four",
>>             "method line five",
>>             ]
>>     }
>> }
>> ...well, sure. Not too shabby, I agree. Good idea!
>>
>> regards, Göran
>>
>>
>
> Goran, what is the advantage of above array over this syntax:
>
> builder addDelta: (
>     builder methodSourceChange
>          class: 'SomeClass';
>          protocol: 'some-method-category';
>          stamp: 'elder 3/21/1996 12:34';
>          source: thisFile nextBracketedString).
> [method line one with a "comment" in it.
> method line two with two plain tabs: "who needs a \t?"
> method line three
> method line four
> method line five]
>
> Details for solving case of few methods having unbalanced brackets [] ?
> Just use thisFile nextBracketedStringWithEscapeSequence in this case.
>
>
How about a perl-ish syntax?

...
source: thisFile uptoNewLineAndEnd).
method line one with a "comment" in it.
method line two with two plain tabs: "who needs a \t?"
method line three
method line four
method line five
END

in this case you don't have to be careful about balanced brackets or
escaping quotes.
It can scan the source up to the cr, 'END' characters sequence.
And in case if method source occasionally contains such sequence
(which can be determined easily), then use different one, randomly
choosen:

source: (thisFile uptoCrWith:'xyz').
method line one with a "comment" in it.
method line two with two plain tabs: "who needs a \t?"
method line three
method line four
method line five
xyz

>
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list