Re: calling handler with named parameters fails from script?
Re: calling handler with named parameters fails from script?
- Subject: Re: calling handler with named parameters fails from script?
- From: Timothy Bates <email@hidden>
- Date: Sun, 01 Apr 2001 16:18:35 +1000
On 4/1/01 2:00 PM, "email@hidden" <email@hidden> wrote:
>
I'd love to call one of my handlers like,
>
>
remove "Dog" from myAnimals
>
>
but I'm stuck with
>
>
remove of "Dog" from myAnimals
>
>
and I can't package that in a script object without the overloading of "of"
>
causing trouble. So I get by with
>
>
tell DoggeralCatcher to removal for "Dog" from myAnimals
I totally support this observation. It is the least readable element of
AppleScript, and fixing it would be a real boon to developing complex but
accessible scripts.
Scott's suggestion of making "of" an optional element when calling direct
parameters is excellent. This simple change fixes 80% of readability
problems for handlers with 2 parameters, and many of the problems with
handlers that are still more complex. however, I still vote for a parameter
name definition in the handler
remove the "dog" from animals of animalObject
on remove the animalName from myAnimals with parameter names{the, from}
--stuff
end
>
maybe, if the handler were defined as,
>
on hname given param1:val1, param2:val2, param3:val3
>
it could be callable as
>
hname param1 arg1 param2 arg2 param3 arg3
That would also be simple, and get us 80% of the way to a complete solution.
tim