RE: interesting discovery (trying to get record labels as strings )
RE: interesting discovery (trying to get record labels as strings )
- Subject: RE: interesting discovery (trying to get record labels as strings )
- From: "Serge Belleudy-d'Espinose" <email@hidden>
- Date: Wed, 5 Dec 2001 16:03:23 +0100
At 21:55 +0000 4/12/01, has wrote:
>
on beepMe()
>
beep
>
end
>
>
set x to beepMe
by calling beepMe without parentheses, you're telling x to set itself to the handler, hence the result:
>
x
>
--> +handler beepMe;
You can then call x as an handler:
>
x()
>
-- the darn thing beeps!
But the following one shouldn't work - did it on your machine?
>
on beepMe()
>
beep
>
end
>
>
set x to beepMe()
Here you're telling x to set itself to _the result_ of beepMe(), which is its last line, which is nothing since beep doesn't return anything:
-> "No result was returned from some part of this expression."
So, lesson of the day - which everybody should now, except that we are learning everyday :)
theHandler -> returns the handler as a script object
theHandler() -> returns the result of the handler
Regarding this very interesting thread, I really would like to know one thing: is it safe to go on using the 'class... as string as record' trick - at least for awhile, until it is 'fixed'? As far as I can understand reading all the posts here, it seems to work on most machines and under most flavours of AS? it would be wonderful if I could count on it, just in time for one of my projects!
I'm having big fun with passing handlers as script objects nowadays. I'm working on Yaams, a replacement to getMods, the mod downloader that goes with the AppleMods site. I intend to make it not only a mod downloader but a mod server as well, thus making it the ultimate link between AppleMods and the end users. I've got to a point where I can see many nice ways to achieve this, but I've yet to find the most efficient one - and universal, since mods are meant to be osaxless.
It's not publicly available yet but a significant part of it has been done. Anyone, please let me know if you are interested in seing what I've done.
Serge
--
\\//\//\// Serge Belleudy-d'Espinose Institut Jacques Monod
// // //
http://www.ijm.jussieu.fr/ Universite Paris VII - Jussieu
//\//\//\\