• 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: Date Variables that modify themselves! Huh?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date Variables that modify themselves! Huh?


  • Subject: Re: Date Variables that modify themselves! Huh?
  • From: Arthur J Knapp <email@hidden>
  • Date: Thu, 05 Jul 2001 10:49:20 -0400

> Date: Wed, 04 Jul 2001 14:17:09 +0100
> Subject: Date Variables that modify themselves! Huh?
> From: Guy Parker <email@hidden>

> In the example as written below the action of modifying one variable
> (DateTimeSend) affects another variable (DateTimeNow) from which the first
> was derived.

> tell application "Finder"
> set DateTimeNow to (current date)
> set DateTimeSend to DateTimeNow --this fails

This is an example of what AppleScript calls Data Sharing. AppleScript
lists, records, script objects, and the date class, work differently
with the "set" command than they do with the "copy" command:

set a to {1, 2, 3}
set b to a -- data-share
set item 2 of a to "z"
b
-- > {1, "z", 3}

a and b both "point" to the same list.

To avoid data-sharing, use the copy command:

> tell application "Finder"
> set DateTimeNow to (current date)
copy DateTimeNow to DateTimeSend

This link to the Language Guide describes Data Sharing, though I
can find no mention in official documentation of the Date class as
a data-sharable object:

<http://developer.apple.com/techpubs/macos8/InterproCom/AppleScriptScripters
/AppleScriptLangGuide/AppleScript.9a.html>


This is a glaring omission in the documentation, and should be addressed.


Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden

Hey, check out:
<http://developer.apple.com/techpubs/macos8/InterproCom/AppleScriptScripters
/AppleScriptLangGuide/>


  • Prev by Date: Re: Rot 13 (OFF)
  • Next by Date: Re: read write basics
  • Previous by thread: Re: Date Variables that modify themselves! Huh?
  • Next by thread: "Size of Finder Selection" for Mac OSX
  • Index(es):
    • Date
    • Thread