Fwd: Re: Passing *possible* variables to a handler
Fwd: Re: Passing *possible* variables to a handler
- Subject: Fwd: Re: Passing *possible* variables to a handler
- From: email@hidden (Michael Sullivan)
- Date: Wed, 17 Jul 2002 16:01:53 -0400
- Organization: Society for the Incurably Pompous
>
Woo-Hoo, that's not true. (I wonder what would happen if a script object
>
tried to sub-class itself...) ;-)
>
>
script o
>
property parent : o
The other day, someone wondered what would happen if a script object
tried to subclass itself...
>
Nigel Garvey did some tests, (off list), in which he showed that
>
repeatedly creating a script object inside a handler like this:
>
>
on theHandler( theValue )
>
>
script obj
>
>
property aProperty : theValue
>
>
end script
>
>
-- stuff
>
>
end theHandler
>
did not seem to take up any excessive amount of time, 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).
My own tests indicate that the extra overhead in making a script object
is minimal, but the overhead involved in compiling any significant code
within the object can be.
Now -- I thought that perhaps script objects wouldn't inherit handler
parameters by reference so that passing large data structures could
result in a copying delay but the following test makes it look like
that's incorrect:
on objList(theList)
script
property a : theList
end script
return result
end objList
set aList to {1, 2}
set bList to objList(aList)
set item 1 of bList's a to 9
{aList, bList's a}
--> {{9,2},{9,2}}
Michael, invisible pass by reference considered harmful
--
Michael Sullivan
Business Card Express of CT Thermographers to the Trade
Cheshire, CT email@hidden
_______________________________________________
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.