Re: Applescript-users Digest, Vol 2, Issue 492
Re: Applescript-users Digest, Vol 2, Issue 492
- Subject: Re: Applescript-users Digest, Vol 2, Issue 492
- From: Ryan Wilcox <email@hidden>
- Date: Wed, 27 Jul 2005 22:44:12 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 7/26/05, at 5:00 PM, email@hidden said:
>No it doesn't. It performs a deep copy of the list object, so any
>mutable items within that list will also be duplicated. To shallow
>copy a list, you have to use 'items of <list>'.
What is involved in the shallow copy? I tried the following:
(*<code language="Applescript">*)
set sk1 to 1
set sk2 to 2
set listItem1 to {sk1}
set listItem2 to {sk2}
set myList to {listItem1, listItem2}
set mycopy to items of myList
set item 1 of mycopy to {42}
log myList
log mycopy
log listItem1
(*</code>*)
I get {1, 2}, {{42}, {2}}, and {1}, respectively. So obviously I'm not
copying a reference to sk1 with my shallow copy.
listItem1 is really just a reference to sk1. I had assumed that a
shallow copy would copy _a reference to the listItem1 list, instead of
creating a copy of listItem1 and sk1. Obviously my assumption was proven
false :)
I'm just curious what AS's definition of shallow copy is :)
Looking forward to hearing the answers (hah! and you thought this thread
was dead :-p )
TIA,
_Ryan Wilcox
================================================================
Wilcox Development Solutions: <http://www.wilcoxd.com>
Toolsmiths for the Internet Age PGP: 0x2F4E9C31
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFC6EZ3bYO0qC9OnDERAl8xAJ9onblZdHkLLNZn/vNp2sfK4IJciACg+Dui
2tEsDXVanmyYQdvWk1yloN8=
=ee1Y
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden