Re: what is the best way to 'unset' a variable
Re: what is the best way to 'unset' a variable
- Subject: Re: what is the best way to 'unset' a variable
- From: Kai Edwards <email@hidden>
- Date: Sun, 24 Mar 2002 14:45:57 +0000
on Sun, 24 Mar 2002 00:57:15 +0000, has <email@hidden> wrote:
>
> As for local variables, those are all destroyed when the handler they're
>
> declared in returns (whether it's a standard run or open handler, or one
>
> defined by the script author).
>
>
And I stand corrected after Chris Nebel's post: variables declared in the
>
run handler persist. You'd have to explicitly declare those as local to
>
avoid this.
Let me rush to your defence, has!
I didn't interpret Chris's comments in quite the same way. I fact it seemed
to me that you were both saying roughly the same thing:
>
On Sat, 23 Mar 2002 10:05:12 -0800, Christopher Nebel <email@hidden>
>
wrote:
>
> This isn't a big issue for local variables, because they get destroyed
>
> automatically when they go out of scope, but it is an issue for
>
> properties and globals, and if you write your script without using
>
> handlers, all your variables are global.
I suppose it really depends on what one infers from "when they go out of
scope". I assumed Chris meant the point at which the handler is exited.
But then... - maybe it's me that's the numpty! ;-)
While on the subject, you also said:
>
> on GetNothing()
>
> return
>
> end
>
>
Uh-uh. That just gives an error on the second line: "No result was returned
>
from some part of this expression."
While I don't doubt what Steven said, I have to confirm getting the same
results as you. This didn't really surprise me at the time - since I
reasoned it would be similar to saying:
---------
set x to
---------
...which of course won't compile - and I defy anyone to say *that* works for
them! ;-)
Best wishes.
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************
_______________________________________________
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.