• 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: list question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: list question


  • Subject: Re: list question
  • From: Michelle Steiner <email@hidden>
  • Date: Wed, 4 Jun 2003 14:48:00 -0700

On Wednesday, June 4, 2003, at 10:09 AM, Doug McNutt wrote:

set a to 2
set b to a
set c to a + b
c
--> 4
set a to a + 1
set c to a + b
c
--> 5

Can you explain just how "b" here refers to the same object as "a". Why doesn't the second calculation return 6? (I'd really be upset if it did!)

Did not "set a to a + 1" mutate the object to which a refers? Is there an immutable value 2 that still exists after I add the 1? I should hope the memory would be reused.

As I understand it now, "set a to a + 1" makes a equal 3. b still equals 2, because the second a now points to 3 and no longer points to 2. It's a new object; the original object didn't mutate, but is no longer being accessed.

To stretch an analogy, the map is not the territory except in the case of lists, etc., in which case the map is the territory.

--Michelle

--
Peter pull at St. Taffy's tonight! (Or is it the other way around?)
_______________________________________________
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.

References: 
 >Re: list question (From: Doug McNutt <email@hidden>)

  • Prev by Date: Mount Volumes
  • Next by Date: Re: Default Path on OSX
  • Previous by thread: Re: list question
  • Next by thread: Re: list question
  • Index(es):
    • Date
    • Thread