brain fever
Stephen Pair
spair at acm.org
Sat Nov 23 14:58:22 UTC 2002
It's fun to think about ways of simplifying syntax. In some ways, I
like Self's implicit "self"...I also like thinking about blocks (and how
to reconcile them with normal methods). Blocks are different from
methods in the following ways:
- they are not in the method dictionary
- they do not have a name (and are not called by name)
- they have access to the activation state of their home method
- they have different syntax for expressing them
There are probably other differences...but I like to think about these
differences and then try and envision a syntax (and perhaps a meta
model) that would accommodate methods and blocks in a more general way.
Also, making the "self" keyword implicit has the effect of making
portions of your code look more functional in nature (even though it's
no less object oriented). A full listing of the methods for a given
object would look strikingly similar to a nicely designed C program
where all of the functions in a given source file are designed to
operate on a given set of variables that are global to the code in that
source file (and which point to the elements of a structure).
- Stephen
> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On
> Behalf Of David Farber
> Sent: Saturday, November 23, 2002 12:47 AM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: brain fever
>
>
>
> Imagine a read-eval-print session that went like this:
>
> > []
> ObjectLiteral[0xD000]
> > [] value
> ObjectActivation[0xD001]
> > `d
> Character[`d]
> > [`d] value
> Character[`d]
> > [:char | `d] value :`c
> Character[`d]
> > [:char | char] value :`c
> Character[`c]
> > [| char :[`d] |
> [> self char] value
> Character[`d]
> > [:char | char :[char] |
> [> self char] value :`c
> Character[`c]
> > [:char | char :`d |
> [> self char] value :`c
> Character['d]
> > ([:char | char :[char] |] value :`c) char
> Character[`c]
> > ([:char |
> +|> char :[char]
> +|> change :[char :`d] |]
> (> value :`c) change; char
> Character[`d]
> >
>
> OK, so I did gratuitously change some syntax around:
> `d => $d
> object msg :arg => object msg: arg
> var :object => var := object
>
> I'm sure there is lots to nit-pick about; for instance, I
> think a lone vertical bar is ambiguous.
>
> But I mostly just let the ideas play themselves out; and I
> must admit that I am very pleasantly surprised--that, of
> course, must mean that someone already had this idea long ago.
>
> david
>
> --
> David Farber
> dfarber at numenor.com
>
>
More information about the Squeak-dev
mailing list
|