Fear and loathing of the "perlification" of Smalltalk
Alan Kay
alan.kay at squeakland.org
Wed Sep 5 03:46:31 UTC 2007
Yep --
There are lots of ways to do this.
One way that is like the fixed patterns of ST-80, but has more
patterns, is the extreme operator grammar technique used by Joe
Goguen for OBJ. This has all the operator possibilities: infix,
outfix, prefix, postfix, etc.
Another way would be to allow implicit self in ST-80. This would
allow control syntaxes that are usually prefixed (like
if...then...else, for, while, etc) to be simple methods of a high
level class (like class object).
As Bert pointed out a few days ago, the semantics of a class in ST-80
is local to the class (each class can have its own compiler). One
could alternately choose to have this be true at the method level.
One could have real method classes whose instances own some of the
polymorphic intent of the method (and also the syntax, including
special syntax that might make the method more clear).
Cheers,
Alan
At 07:02 PM 9/4/2007, Andreas Raab wrote:
>Peter William Lount wrote:
>>I wonder Alan, if you could, expand on what you mean by "but it
>>needs to be done at the same level as regular programming (so it
>>can be used by any base version of the language)"?
>
>Isn't that obvious? When you add the method #frobler to Object you
>extend the language. And at the same level as regular programming.
>For example, one could consider implementing operators that way, say
>in a Prolog style, priority driven way:
>
>Object>>plus: anObject
> <operator: #+ type: #yfx priority: 500>
>
>Object>>minus: anObject
> <operator: #- type: #yfx priority: 500>
>
>This implements all the semantics as plain messages but leaves
>operators as syntactic sugar on top of them. The compiler would
>translate "a + b" into "a plus: b" and the decompiler -if it knows
>about the plus operator in your system- would decompile as #+. If it
>didn't know about it, it would decompile as #plus:. Your code would
>depend on the "PlusMinus" package that other people have to load
>(since it contains the operator definitions). Etc. It's pretty straightforward.
>
>Cheers,
> - Andreas
More information about the Squeak-dev
mailing list
|