Re: Technical question: subroutine ou submethod?
Re: Technical question: subroutine ou submethod?
- Subject: Re: Technical question: subroutine ou submethod?
- From: Christopher Nebel <email@hidden>
- Date: Mon, 15 Sep 2003 00:19:03 -0700
On Sep 14, 2003, at 2:18 AM, Emmanuel wrote:
At 12:06 AM +0200 13/09/03, Reinforced Darkness wrote:
consider this script:
//
get my compute(this_data)
on compute(this_data)
-- anything on this data
return the_result
end compute
//
this one:
//
tell me to compute this_data
to compute this_data
-- anything on this data
return the_result
end to compute
//
both produce the same task, what's the best to use for speed, memory
use...
I don't know for speed nor memory use, but I can tell you for
AppleScript syntax: the best is the first one. The second one won't
compile I'm afraid.
...because the second form requires that the handler name be defined in
application (or scripting addition) terminology. It arguably
shouldn't, but it does.
As for differences in execution profile, there's nothing significant.
There are differences in how they handle parameters -- positional vs.
labeled -- but that's fairly trivial. I suppose if you had *really*
large numbers of parameters, positional might be a win, given how
AppleScript record lookup works currently, but you'd have to have
thousands of parameters to notice.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.