[squeak-dev] Re: Deltastreams update
nicolas cellier
ncellier at ifrance.com
Thu Mar 12 19:36:51 UTC 2009
Ralph Johnson <johnson <at> cs.uiuc.edu> writes:
>
> On Thu, Mar 12, 2009 at 9:35 AM, Göran Krampe <goran <at> krampe.se> wrote:
>
> > - Not so good handling of Strings. This was why I was thinking about
> > netstrings. In fact, this one is a killer in some ways, if we can't have CRs
> > in the file then we surely can't get "readable code". Yaml has "literal
> > blocks" which means we can easily have readable code.
>
> You are thinking of a method as being the smallest element. Instead,
> make a method be a sequence of lines. A line is basically everything
> between a CR. This will make it a little less readable, but not too
> much.
>
> -Ralph
>
>
I don't understand why we should bother with YAML, XML, JSON...
And why to limit ourself to a static description of things?
Why don't we consider using plain Smalltalk Syntax, and plain Smalltalk power?
The MESSAGES.
What about letting DeltaStream be a list of executable Smalltalk sentences, not
a list of lines delimited with CR, nor a list of chunks...
The Parser is already equipped to parse a Smalltalk sentence, so let define a
subclass FileParser (or StreamParser) that would:
1) parse and execute sequentially sentence by sentence.
2) declare every Undeclared variable as a global in the file scope
(like a Workspace).
3) predefine a variable thisFile in file scope pointing to the stream.
This reflexivity enables plenty of things like inlining source with a:
(thisFile nextBracketedString).
Example of naive DeltaStream API:
"------------------"
deltas := OrderedCollection new.
deltas add: (MethodChange className: 'MyClass' sourceCode: thisFile
nextBracketedString).
[myMethod
^nil]
deltas add: (ClassComment className: 'MyClass' comment: thisFile nextChunk).
MyClass is aimed at representing my objects
inst vars:
name <String> the name of my object instance
!
^deltas
"------------------"
We could of course store a lot of Method attributes category-author-license...
method := MethodChange
className: 'MyClass' sourceCode: thisFile nextBracketedString;
author: 'nice';
license: 'MIT';
category: 'accessing'.
[myMethod
^nil]
deltas add: method.
We don't even have to use classes names like MethodChange:
Predefine a file scope variable theBuilder := DeltaStreamBuilder new.
theBuilder license: 'MIT'.
theBuilder addMethodFor: 'MyClass' sourceCode: etc...
We have replaced class names with an API.
As a result, theBuilder can be set to another class just enumerating non-MIT
licence or whatever task you want it to.
Isn't that simple enough?
Is there a good reason to restrict our power?
Nicolas
More information about the Squeak-dev
mailing list
|