Making blocks more like methods
Bert Freudenberg
bert at isgnw.CS.Uni-Magdeburg.De
Sat Apr 22 21:22:20 UTC 2000
On Fri, 21 Apr 2000, Stephen Pair wrote:
>
> And! Better yet, if you drop the requirement to use "self" when sending
> messages to the receiver you could write quite elegant procedural code! For
> example (vertical bars used for clarity):
>
> [ output: aString | Transcript show: aString; cr ].
> [ printName | output: 'George P. Burdell' ].
> [ printAddress | output: '555 North Avenue' ].
> printName
> printAddress.
>
> But, now I'm just being silly!
OTOH the above looks like it could become a declarative ST80 syntax,
something like this:
MyClass methods: {
[ name: aString | name := aString ].
[ name | ^name ].
[ sayHi | Transcript show: 'Hello ', name; cr].
}
-Bert-
More information about the Squeak-dev
mailing list
|