Smalltalk scripting (was Re: jpython anyone?)

Aaron J Reichow reic0024 at d.umn.edu
Mon Dec 11 23:28:26 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:
> > What's a script look like? Well maybe (for *nix) something like
> > -----
> > #!path/to/squeak
> > 
> > | temp | "Well, why not allow explict declarations? ;)"
> > 
> > def helperFunction: [:x :y |
> > 	x doesSomethignTo: y].
> > 
> > "sugar for helperfunction := [:x :y....]"
> > 
> > temp := someInput.
> > 
> > helperFunction (temp, argv at: 1).
> > "sugar for helperFunction value: someInput value (argv at: 1)"
> > ------
> 
> Gnu Smalltalk is somewhat like this.
> 
> Why not use Gnu Smalltalk's syntax here (instead of defining keywords
> like "def"). 

I agree.  I think

| foo bar helperFunc |
"Declare the vars you need!"

helperFunc := [ :name :age | name blah: age ]
foo := stdin inputWithPrompt: 'Enter name: '.
bar := stdin inputWithPrompt: 'Enter age: '.
stdout show: (helperFunc value: foo value: bar).

would be more appropriate.  A while back, someone posted a changeset to
get a somewhat more traditional syntax for evaluation blocks, in which the
above block would be called with helperFunc{foo, bar}.  I don't have the
CS, but I'm sure it's floating around somewhere.

Aaron

Aaron Reichow                   :: "In essence, Smalltalk is a programming
Twin Ports ACM Vice President   ::  language focused on human beings rather
http://www.d.umn.edu/~reic0024/ ::  than the computer." - Alan Knight






More information about the Squeak-dev mailing list