Re: by-value vs by reference (was Re: list question)
Re: by-value vs by reference (was Re: list question)
- Subject: Re: by-value vs by reference (was Re: list question)
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 05 Jun 2003 19:58:12 -0700
On 6/5/03 6:47 PM, "Doug McNutt" <email@hidden> wrote:
>
At 18:14 -0400 6/5/03, Andrew wrote:
>
> Here's a quick re-cap of all the information that's been passed on in this
>
> thread with some definitions.
>
SNIP
>
>
I learned a few things from that. Thank you. In spite of comments by others,
>
it does help to compare AppleScript to other compilers.
>
>
Just for fun I tried your imaginary Applescript.. I would like to nominate the
>
error message for an obfuscated Applescript contest:
>
>
set a to 3
>
set b to a
>
set c to a + b
>
c
>
--> 6
>
set the value of a to 4
>
set c to a + b
>
c
>
--> can't set value of 3 to 4
That's actually because 'value' has no meaning in this context: it is some
sort of AppleScript keyword (probably a property of some class or other) but
can't be used with integers. Why are you using 'value'?
>
>
set a.value to 4
>
>
Generates a much better rejection.
>
"An unknown token can't go after this identifier" (with the "a" selected.)
>
>
It appears that my "a" isn't a reference to an object at all. The compiler may
>
well be nothing more than a macro processor which replaces "a", when it sees
>
it, by its current lexical value. That would confuse the error processor which
>
would see:
>
>
set the value of 3 to 4
>
>
which, of course, it "can't do".
No, you've got it wrong. First of all, "." is a word separator in
AppleScript.
a.value
means nothing. It's a variable (a) followed by a token (.) which has no
meaning, followed by more characters (value). "." is not a valid character
of a variable name.
So, as the error message said, an unknown token (.) can't go after an
identifier (a). "identifier" is another name for "variable". This is
actually one of the clearer error messages around. Not obfuscated at all.
It's exactly correct: it says "Don't put a period after a variable name."
AppleScript does not use dot language, I presume you know.
--
Paul Berkowitz
_______________________________________________
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.