Squeak scripting syntax (was: Re: how to get arg and print on the
output)
Andreas Raab
andreas.raab at gmx.de
Mon Aug 21 13:56:33 UTC 2006
Couple of years back I used something quite similar to Ian's version -
the main difference was that instead of prototypes it used classes so it
would look like this:
Object subclass: #Point definition: #[
| x y |
magnitude [
^((x * x) + (y * y)) sqrt
]
]
(I still have an ~400k image based on this stuff ;-) The trick in the
above is that I redefined #[] to mean a "token array" that would be
processed as part of the #subclass:definition: message so it retained
the expression nature of class definitions. It's kind of cool but also
overkill - these days I'd go straight for human readable syntax instead
of fancy parser tricks ;-)
Cheers,
- Andreas
Bert Freudenberg wrote:
> florent trolat schrieb:
>> stéphane ducasse a écrit :
>>>>
>>>> Right - so this really only applies to headless command line use. So
>>>> why not create a special squeak shell for them?
>>>>
>>>> You could create a stripped image with OSProcess preloaded, write a
>>>> small shell script or launcher program (say, "squeash") that runs a
>>>> headless VM with the image, et voilà, Squeak for scripting.
>>>
>>> Exact! And with a syntax for writing method and class without !! and !
>>> I will give a try at that.
>>
>> (hi,) an example of syntax?
>
> I like Ian's:
>
> http://piumarta.com/pepsi/pepsi.html
>
> There are others, like
>
> http://www.double.co.nz/smallscript/byexample.htm
>
> - Bert -
>
>
>
More information about the Squeak-dev
mailing list
|