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: has <email@hidden>
- Date: Wed, 5 Dec 2001 21:43:37 +0000
Serge Belleudy-d'Espinose wrote:
>
But the following one shouldn't work - did it on your machine?
>
>
> on beepMe()
>
> beep
>
> end
>
>
>
> set x to beepMe()
Ah yes, this is what happens when I spend too long on stuff like this: my
brain fuses completely and I see miraculous things when there is, in fact,
nothing there. What an absolute twit. Please feel free to make like Winston
Smith and edit that little gem out of history as if it was never there. I
can't believe I ever said that.
The rest, however, is absolutely kosher, and a jolly cool trick to pull at
parties too.
>
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!
IMHO, you could write a routine that'll try it first and if it doesn't give
the expected result, use a guaranteed-to-work "run script"-based method
instead:
======================================================================
on convertToRecord(params)
try
{{[LEFT-DOUBLE-CHEVRON]class usrf[RIGHT-DOUBLE-CHEVRON]:{"a",
[NO-BREAK]1}}} as string as record
get result's a --did it work OK?
return useDoubleCoerceMethod(params)
on error
return useRunScriptMethod(params)
end try
end convertToRecord
======================================================================
Then you can't fail: the only difference will be in how fast you get the
result.
If you're going to be converting more than one {name, value} pair, I'd
recommend using a version of hashLib's convertListToRecord() handler. Take
yourself a copy of it and tweak the code a bit, replacing "do script" with
"run script" to make it free of Smile. The way it works, it can convert any
number of {name, pair} conversions using just a single "do script"/"run
script" command - for some reason I've found Olof's method reluctant to
convert more than one {name, value} pair at a time (though if I've missed
something then Olof is free to kick me...;).
>
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.
This sounds _very_ interesting. I'm curious, but as you can maybe tell I'm
already getting a bit ditzy with all the other stuff I'm trying to do so am
maybe not the best person to ask for advice about now;). Though might not
say 'no' to a quick look.
Again, I can't help wishing that AS had a strong structure for supporting
mods as it does for osax - it would go a long way to promoting both mods
(saving a lot of folk from regularly reinventing wheels), and encouraging
modular coding & design in general (which is a good idea for anyone writing
moderately complex code). Perhaps once ASS is out the door and taking care
of AS's front end (and very nicely, I suspect), the AS team will have a
chance to spend some quality time working under the hood?
Cheers,
has