Fear and loathing of the "perlification" of Smalltalk
Andreas Raab
andreas.raab at gmx.de
Wed Sep 5 02:02:59 UTC 2007
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
|