[squeak-dev] Clamato

Stephen Pair stephen at pairhome.net
Fri Dec 4 04:41:23 UTC 2009


Wow...I completely missed the Clamato announcement.  Fantastic!

On Fri, Sep 4, 2009 at 1:53 PM, Dan Ingalls <Dan at squeakland.org> wrote:

> Hi, Avi -
>


> >I don't love the @ syntax, but it has at least two advantages.  One is
>  >that, by essentially moving instance variable declarations into the
> >methods, you can easily add instance variables to classes in other
> >packages - Squeak has never had a good way to do this.  The other is
> >that methods can be parsed and compiled with no context - unlike in
> >Smalltalk, can identify instance variables vs. temps vs. globals
> >without knowing anything about the class you are compiling the method
> >for.  OTOH it's kind of ugly.
>
> With all due respect, I agree ;-).


What if you used normal temp var declaration syntax, but just added an "@"
to indicate instance variables...here is the counter example rewritten in
that form..it seems more palatable to me and would have the advantages you
mention:

<Example>

- open
| @root |
root := '#example' q.
 self reload.
self.

- reload
| @root |
 root contents: [:html | self renderOn: html].

<Counter>

+ superclass
Example.

- initialize
| @counter |
counter := 0.

- renderOn: html
| @counter |
html h3 with: counter.
 html button
with: '+';
onClick: [counter := counter + 1. self reload].
 html button
with: '-';
onClick: [counter := counter - 1. self reload].
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20091203/55d79a64/attachment.htm


More information about the Squeak-dev mailing list