Smalltalk scripting (was Re: jpython anyone?)
Bijan Parsia
bparsia at email.unc.edu
Mon Dec 11 22:53:34 UTC 2000
On Mon, 11 Dec 2000 ajalis at twu.net wrote:
> On Mon, Dec 11, 2000 at 04:54:31PM -0500, Bijan Parsia wrote:
[snip]
> Gnu Smalltalk is somewhat like this.
I suspected.
> Why not use Gnu Smalltalk's syntax here
If you mean in SqueakScripts, no reason. If you mean in my note, well
because I didn't know Gnu Smalltalk's syntax off hand ;)
> (instead of
> defining keywords like "def").
def! A *keyword*! Perish the thought! It was an implicit script global
which holds an instance of "BlockMapper". BlockMapper takes the keyword
argument (a block) and the keyword selector (say, 'testMethod:') and makes
a temp (#testMethod) and then assignes the argumetn to it.
So,
def testMethod: [:x | x + x]
Is equivalent to:
| def |
def := BlockMapper onCurrentScript.
def testMethod: [:x | x + x].
And this is equivalent to
| testMethod |
testMethod := [:x | x + x].
(Of course, there's some needed trickery to deal with the fact that
blocks aren't closures yet.)
And all this, of course, is fakery, since I haven't written anything like
this (yet ;)). It was just meant to illustrate the kinds of considerations
one might face. If one's target audience is hard core smalltalkers, I
suspect that any sugar is a pain in the tuckus. If the point is making a
generally useful tool even for those who may not do more than write little
5-10 line scripts, perhpas the sugar is a good thing.
(I will check out the Gnu Smalltalk script syntax, though. :))
Cheers,
Bijan Parsia.
More information about the Squeak-dev
mailing list
|