Re: Passing *possible* variables to a handler
Re: Passing *possible* variables to a handler
- Subject: Re: Passing *possible* variables to a handler
- From: has <email@hidden>
- Date: Tue, 16 Jul 2002 20:03:31 +0100
Arthur J. Knapp wrote:
>
> 1. I stumble across something vaguely interesting and mention it to the
>
>list.
>
>
How do you do this, by the way ?!?!?!
Talent.
--
>
>> 3) And finally - I have occasionally used the Serge technique in a handler
>
>> which itself is revisited many times in the main script's repeat loop. As
>
>> far as i can see, that means I'm having to constantly re-initialize the
>
>> embedded script object a zillion times. Would this be a situation where the
>
>> script object in the handler could just be initialized once and its values
>
>> (the list which forms its own property) replaced a zillion times instead?
>
>
Nigel Garvey did some tests
[...]
>
ie: there does not
>
appear to be any major reason to create objects outside of the context
>
of where they are needed. (I'm sure there would be lots of exceptions to
>
this, however).
Not that that was the reason to begin with. If you are looking for
potential reasons for why you might want to use a full-blown OO approach
rather than the quick-n-dirty property-in-a-script kludge:
- Write once and forget. [Need I mention "all thoroughly tested and
documented" as a corollary?]
- Delegation of responsibility. [Synonyms: somebody else's problem;
plausible deniability; "...not MY fault if it breaks."]
- Neatness. [A rare and valuable commodity.]
- Modular/OO Design Fetishism. [Perhaps you can have too much of a good
thing, but I haven't hit my personal pain barrier yet....]
I'll maybe try some tests to see what the practical performance difference
of the two approaches is in, say, a quicksort (since that's usually one of
those standalone routines/algorithms you want to optimise for performance
over other aspects such as readability/maintainability).
--
Incidentally, had an interesting thought/question about the way AS
reallocates a list in memory as it grows. Chris N explained a while back
that it's reallocated for every 16 items added; each time adding enough
extra room for another 16 items before. Which got me wondering: why doesn't
AS allocate twice as much extra space that was previously allocated,
trading some memory efficiency for improved speed? Secondary to the O(1) vs
O(n) issue, but perhaps still something to ponder on...
Cheers,
has
p.s. Lied about the "talent" thing.
--
http://www.barple.connectfree.co.uk/ -- The Little Page of Beta AppleScripts
_______________________________________________
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.