Re: Dates gone wild
Re: Dates gone wild
- Subject: Re: Dates gone wild
- From: Doug McNutt <email@hidden>
- Date: Tue, 9 Sep 2003 05:46:12 -0600
At 10:10 +0100 9/9/03, Nigel Garvey wrote:
>
Paul Berkowitz wrote on Mon, 08 Sep 2003 21:05:38 -0700:
>
>set ls to {}
>
>set d to date "Friday, September 5, 2003 12:00:00 AM"
>
>set end of ls to d
>
>set d to date "Sunday, October 5, 2003 12:00:00 AM"
>
>ls
>
>--> {date "Friday, September 5, 2003 12:00:00 AM"}
>
>
That's right. The variable d isn't in the list, it just points to the
>
same date as is pointed to by the one pointer in the list. When you set d
>
to a different date, it simply points to a different date object. The
>
pointer in the list still points to the original.
Not long ago I was chastised for using the term "pointer" on this list. I was trying to figure out what a "reference" really was.
Are you saying that "set end of ls to d" really means "place a reference to d at the end of ls"? If so I would expect changing the value stored in the reference would change the result obtained above. Does it matter if d is an object or a variable?
We have been down this turnpike before and I remain frustrated. If someone would use precise terms to define "reference" instead of saying fuzzy things like "It's much higher level than a pointer." Or "It's all text." perhaps we could get it straight.
Actually it seems to me that references are used when the AppleScript compiler finds an expression "complicated enough" to use them. set and copy do the same thing for simple things but set installs a reference when, in the compiler's opinion, things are complicated enough to warrant it. In this case the list contains only one item of class date; would it behave the same way if there were 100 items? What if the object contains 2000 characters? What about being in a tell block?
When does a variable become an object? (Isn't everything supposed to be an object?)
set ls to {}
set ds to "Friday"
set end of ls to a reference to ds
set ds to "Sunday"
contents of ls
--> {"Sunday"}
set ls to {}
set ds to "Friday"
copy ds to end of ls
set ds to "Sunday"
contents of ls
-->{"Friday"}
--
Applescript syntax is like English spelling:
Roughly, but not thoroughly, thought through.
_______________________________________________
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.