Re: How can you tell whether you have a reference or not?
Re: How can you tell whether you have a reference or not?
- Subject: Re: How can you tell whether you have a reference or not?
- From: Kai <email@hidden>
- Date: Fri, 07 Feb 2003 04:35:17 +0000
on Thu, 6 Feb 2003 12:06:01 -0800, "Nathan Herring" <email@hidden>
wrote:
>
If I have a local variable, how can I tell whether it's a reference to
>
something or just a value class?
>
>
e.g.
>
>
set foo to 1 -- value class
>
set bar to a reference to foo -- reference class
>
>
class of foo and class of bar both return integer.
>
>
Any way to know?
I suppose you could just try a coercion:
========================
on isRef(x)
try
x as reference
true
on error
false
end try
end isRef
set foo to 1
set bar to a reference to foo
{isRef(foo), isRef(bar)}
--> {false, true}
========================
--
Kai
_______________________________________________
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.