[squeak-dev] Re: Deltastreams update

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Deltastreams update

Nicolas Cellier-3
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.




Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: Deltastreams update

Igor Stasenko
2009/3/13 Nicolas Cellier <[hidden email]>:

> 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.