Re: 'to' as a handler parameter label
Re: 'to' as a handler parameter label
- Subject: Re: 'to' as a handler parameter label
- From: Nigel Garvey <email@hidden>
- Date: Wed, 17 Jan 2001 00:17:01 +0000
email@hidden wrote on Mon, 15 Jan 2001 22:24:11 -0500:
>
On Mon, 15 Jan 2001 01:41:28 +0000, Nigel Garvey <email@hidden>
>
asked,
>
>
> The expression 'to' works as a parameter label for a handler:
[snip]
>
> ...but it isn't mentioned in the sacred texts as being one of the
>
> Twenty-Four Allowable Labels. Is it Allowed? If not, what's happening
>
> here? It doesn't seem to be a synonym for 'on', as it compiles like a
>
> label rather than like an AppleScript keyword.
>
>
Its in the AppleScript 1.3.7 (MacOS 8.6) English Dialect file, as one of the
>
keywords for the "Call*Subroutine" command.
[...]
>
Can you use it safely, or will your code go the way of the dinosaur, like
>
if you
>
were to use, "item -1 to 0 of x"? Not sure. Its undocumented, so it might
>
go
>
away without warning.
Hmmm. That's what I figured. The handler which showed this up actually
uses 'at, the nearest approximation to 'to' for my purposes. It was
because I accidentally typed 'to' in a call to the handler, and found
that it compiled, that I tried it in the handler definition too. But come
to think of it, ASLG does actually use 'to' as a handler parameter label
in the discussion on script objects on p.326:
script John
property HowManyTimes : 0
to sayHello to someone
set HowManyTimes to HowManyTimes + 1
return "Hello " & someone
end sayHello
end script
>
Sidelight: while looking for any chance that this was documented, I came
>
across
>
Apple's definition of inches as 39.3700787... inches to the meter. In US
>
law,
>
the meter is 39.37 inches exactly, as it was codified in the US Metric Law
>
of
>
1866. Maybe the "Imperial" inch Apple provides is correct in Canada and
>
the UK.
I see you've retracted this in a later post. The 'as used in Canada' quip
was a good one though. :-) According to the entry for "metre" in my
dictionary, British law defines the yard as .9144 metres - so that's
1/.9144 yards to a metre or 36/.9144 (= 39.370078740157) inches. In
AppleScript, 'meters 1 as inches' returns 'inches 39.37007874015'.
I can imagine some politician introducing a Bill into Parliament to set
the legal definition of Pi. The Government - and the opposition - would
collapse about three seeks into the first reading. :-)
NG