Re: First-class procedures in AS
Re: First-class procedures in AS
- Subject: Re: First-class procedures in AS
- From: Christopher Nebel <email@hidden>
- Date: Wed, 17 Dec 2003 21:36:41 -0800
On Dec 17, 2003, at 6:42 PM, Jim Witte wrote:
Does Applescript allow you to compile procedures at runtime and treat
them as first-class objects? I thought an interesting (if seemingly
useless, except perhaps as a CS independent study) project would be to
try to implement a subset of Scheme in AppleScript.
Some. Not entirely. Handlers (AppleScript's name for
procedures/functions) are objects, but there isn't much you can do with
them -- you can pass them around, call them, and assign them to
properties of scripts (people sometimes do this by accident!). You can
compile scripts from source using "run script", but there isn't any way
to tear apart an existing handler like there is in Lisp -- code is not
treated as data in that respect.
You might find it interesting to read M. Neuberg's new book,
"AppleScript: The Definitive Guide." He's an old Lisp-head himself,
and assuming it didn't get ripped out in final edits [1], there's some
material covered under script objects about how to exploit
handlers-as-objects, and how to use script objects to create
closure-like effects.
--Chris Nebel
AppleScript Engineering
[1] I helped review AStDG, but haven't seen a final copy.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.