Re: Damn send button / Wind chill
Re: Damn send button / Wind chill
- Subject: Re: Damn send button / Wind chill
- From: "J. B Stewart" <email@hidden>
- Date: Sun, 03 Mar 2002 22:45:38 -0500
On 3/3/02 21:22, "Shane Stanley" <email@hidden> enscribed:
>
> Ran this, which did show a difference between current date inside one (or
>
> two) tells, and a naked current date (500 was not enough repetitions...all
>
> results were 1; kept the style of reporting results backwards):
>
>
>
> set repetitions to 20000
>
> set time1 to the current date
>
> repeat repetitions times
>
> tell application "Finder"
>
> tell application "BBEdit 6.5"
>
> current date
>
> end tell
>
> end tell
>
> end repeat
>
> set time2 to the current date
>
> repeat repetitions times
>
> tell application "BBEdit 6.5"
>
> current date
>
> end tell
>
> end repeat
>
> set time3 to the current date
>
> repeat repetitions times
>
> current date
>
> end repeat
>
> set time4 to the current date
>
> {time4 - time3, time3 - time2, time2 - time1}
>
> --> {9, 53, 53}
>
> -- units are seconds; machine is dual 533 with plenty of RAM, Mac OS X
>
> 10.1.3; AS 1.8.1
>
>
>
> I find nothing surprising there.
>
>
And does it not suggest that whether a "tell app" is nested inside another
>
or not makes no difference to the performance of its contents?
>
>
--
When you consider that every script runs in the context of a current
application tell (per ASLG) and that every tell you insert into a script is
"nested" within the context of that implied tell. It most certainly makes a
difference.
This errors when run from Script Debugger -
tell current application
tell application "Finder"
path to desktop
end tell
end tell
As does this even though the "current app" is still Script Debugger -
tell application "Finder" -- note: Script Debugger is active application
tell current application -- but this tell still sees the Finder not SD
path to desktop
end tell
end tell
This doesn't error and it returns the requested path -
tell current application -- still Script Debugger
path to desktop
end tell
<sarcasm>
Ok, now I'm sure that someone will post that all this is beside the point.
Just because a nested tell is causing an error and is a bad coding practice
it isn't really causing an error and isn't really a bad coding practice.
It's all just a figment of my anal retentive imagination. Oh and a 10 fold
increase in speed is really negligible. I mean why would you want your
paycheck today when you can have it Wednesday of next week instead?
</sarcasm>
The point some of us have tried to make is that using nested tells can lead
to all sorts of nasty little surprises as well as time lost in execution and
debugging headaches. None of us contend that these will always happen when
you nest tells only that they sometimes do and those times are easily
avoided by not nesting Tells to begin with.
John
_______________________________________________
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.