• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How can you tell whether you have a reference or not?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Encrypting passwords with AS
  • Next by Date: Newbie Question - Recommended method of idling?
  • Previous by thread: Re: How can you tell whether you have a reference or not?
  • Next by thread: Re: How can you tell whether you have a reference or not?
  • Index(es):
    • Date
    • Thread