Re: Damn send button / Wind chill
Re: Damn send button / Wind chill
- Subject: Re: Damn send button / Wind chill
- From: Ed Stockly <email@hidden>
- Date: Sun, 03 Mar 2002 15:14:11 -0800
>
AppleScript allows nested tells, a axe allows itself to be used as a hammer.
>
Doing so isn't a good idea.
You're using a false analogy in your argument here. My point is that the
AppleScript language was specfically designed to accomodate nested tells.
It's a legacy from its roots in the Hypertalk language where there was an
object hierarchy for commands sent to a button. If the button didn't handle
the command it would be sent to the card, the background, then the stack
then the home stack then the application in that order until the command was
handled.
An ax is designed to chop wood and split rails and it has a flat surface
designed to pound wedges in to cut logs. It is not designed to hammer nails
and should not be used that way.
>
Absolutely correct, A Quark command will go directly to Quark, so will a
>
scripting addition command, an AppleScript command or any other command. Not
>
only will they go to Quark they will also be looked at by the Finder before
>
going where they were meant to go. This adds execution time and chances for
>
conflicts I personally would choose to avoid. If I recall correctly
>
AppleScript's treatment of commands is spelled out in the ASLG.
Ok, Paul Berkowitz and others have argued in the past that Osax commands
shouldn't be included in application tell commands and this is more of a
rehash of that argument.
The issue of Osax commands being sent to applications adding to execution
time is not unique to nested tells but can add time when issuing any Osax
command in an application tell.
And again, I'd argue that AppleScript was designed so scripts could be
written just that way.
>
I disagree! Why build in poor execution times and chances for errors?
I haven't seen any documentation that the practice increases any chance of
scripting errors? What are you talking about?
>
No, AppleScript was designed to allow for it happening and that's what it
>
does. Saying it was designed to work this way implies that we should use the
>
technique whenever possible and considering the problems it can induce I
>
don't believe that is true.
AppleScript was designed to be a natural and intuitive scripting language
and including Osax calls in application tells and nested application tells
is part of that overall design. It's been part of the language from the
beginning and can be found in Hypertalk, the model for AppleScript.
Remember the AppleScript designers gave things like clarity and ease of use
a much higher priority than efficiency and raw speed.
Also, no one is arguing "we should use the technique whenever possible". My
argument is that it works, it doesn't cause problems, doesn't add
significantly to execution time and helps keep complex scripts simple and
readable. We shouldn't be afraid of it.
I'd also argue it makes it easier to learn scripting with nested application
tells and it irks me when a novice scripter is struggling with what should
be a fairly straigt forward script but they're trying to figure out how to
send a command to a Quark story inside a text box tell; inside a page tell;
inside a spread tell; inside a document tell; inside an applicaiton tell,
then send the next command to the finder and the next command back to the
same story in quark because they were 'taught' not to use nested application
tells. Whay make the complex even more complex?
>
There is a place for nested tells, they do work (sometimes)
When do they not work? Give me one example of a command inside a nested
tell that would work if the application tell were un-nested.
>
>>> Otherwise you risk some bad debugging headaches.
Well you've made a case that they may slow things down a tiny bit, but now
you're claiming they cause bugs?
As far as slowing things down, I think it's time we quantify this. There
are a number of script timing systems out there that will provide a way to
measure just how much time we're talking about wasting here. I think you'll
find that it's not a significant ammount, unless you're doing thousands of
repeats.
The non-anal-retentive among us need a better reason ; >
ES
_______________________________________________
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.