Whither SmallScript? (was Re: Integer micro-benchmarks)
Dave Harris
brangdon at cix.co.uk
Mon Apr 30 14:22:00 EDT 2001
dnew at san.rr.com (Darren New) wrote (abridged):
> It's been too long since I used Smalltalk, but doesn't |f| inside a
> smalltalk block declare a block-local temporary, rather than an
> argument? I
> thought it was something like
>
> [ f: g: |q r| code goes here ]
> that says "f" and "g" are arguments, q and r are temps?
Close. There's an extra bar and the colons go the other side of the
variables.
[ : f : g | |q r| code goes here]
It as if there were an invisible message selector keywords before the
arguments. Compare with method definitions:
with: f and: g
|q r|
code goes here
the "with" and "and" are part of the method's name, so the block is like
an anonymous method.
> If I'm remembering right, I'd say it's a minor faux pas to use syntax
> from Smalltalk and have it mean something subtly different.
Well, it's not like this part of Smalltalk is ideal.
Dave Harris, Nottingham, UK | "Weave a circle round him thrice,
brangdon at cix.co.uk | And close your eyes with holy dread,
| For he on honey dew hath fed
http://www.bhresearch.co.uk/ | And drunk the milk of Paradise."
More information about the Python-list
mailing list