Re: Dialog from script application displays raw codes
Re: Dialog from script application displays raw codes
- Subject: Re: Dialog from script application displays raw codes
- From: has <email@hidden>
- Date: Wed, 30 Aug 2006 00:00:17 +0100
kai wrote:
I think you meant to say "interpreter", not "compiler". The AS
compiler isn't involved in running scripts, either in Script
Editor or in an applet.
[...]
When running a script, one situation in which the involvement of
the compiler might be presumed is when a 'run script' command is
encountered (as in the earlier example). Are you saying that's not
the case?
No, 'run script' uses the AS compiler to compile the source code
string, just as you expect. What I'm saying is that this statement:
we need a way of forcing the compiler to decompile raw codes like
«class cfol» and «class docf» into their more readily recognised
terms: "folder" or "document file"
is incorrect, because the compiler is not involved in runtime
conversions of AE codes to their human-readable equivalents. It's the
interpreter that's coercing your type classes to strings. What your
'run script' trick does is ensure that the Finder's terminology will
be available for the interpreter to use when it performs that coercion.
Incidentally, you don't get this problem with Python+appscript,
because appscript always loads application terminologies at runtime
so that it can do name-code translations on the fly. The tradeoff is
that Python scripts have a higher startup overhead, since they're
loading and parsing this terminology each time they run. With
AppleScript, terminology is loaded and parsed only when compiling
scripts. That means lower overheads when running compiled scripts,
with the minor disadvantage that application-specific terminology
isn't guaranteed to be available at the time. Given that AS
originally had to run on 20MHz machines, this was an entirely
acceptable tradeoff.
Mind you, if AS were smarter, it'd store the pre-parsed keyword-code
translations for application-defined class and constant names within
the compiled script. That way the interpreter would always have
access to that information when coercing type classes and constants
to strings. Probably a bit late to file a feature request now though. :)
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden