Re: set myList to myList & ...(Digest, Vol 2, Issue 493)
Re: set myList to myList & ...(Digest, Vol 2, Issue 493)
- Subject: Re: set myList to myList & ...(Digest, Vol 2, Issue 493)
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 27 Jul 2005 12:28:01 -0400
On 7/27/05,
Jonathan Levi MD <
email@hidden> wrote:
However, in the example that followed and is reproduced below, the
comment "Wrong!" by (a second) previous writer has to do to with
value-vs-reference, not concatenation:
> >>set
l to
{1}
(1)
> >>set a to l &
{} (2)
> >>set
b to {} &
l (3)
> >>
(4)
> >>set l's item 1 to
2 (5)
> >>log
a -->
{1} (6)
> >>log b --> {2} -- Wrong! Should be {1} (7)
The second writer doesn't object that a concatenated value is missing
somewhere: He objects that the value shown by "log b" in line (7) is
the wrong value, albeit with the right number of list elements. The
question of the "wrong" value of {2} vs. the "right" value of {1} is
indeed addressed by assignment to l (in line (3)) by reference,
rather than the value.
The problem isn't that b is getting assigned a reference; that's
correct. The problem is that b is getting assigned a reference
*to l*. What it should get assigned is a reference to the
result of ( {} & l ), which should be a new list. The
argument is for consistency: in every other case, including ( l &
{} ), a new list is created and returned (by reference) from the &
operator, but in the case of ( {} & l ), the operator is just
returning a reference to l itself.
Yes, but what is getting assigned to b is a reference to *l*.
What *should* get assigned to b is a reference to the result of {}
& l, which should be a new list.
If there is a failure of concatenation, please show me where it is,
with line number and expected result. Other subscribers will also
find a more detailed explanation helpful, I am sure: it has long been
my observation that if I'm in a group and I don't understand
something, there's generally at least one other person in the group
who doesn't understand it, either.
Paul, if you find that my comments have been made irrelevant because
someone else has replied first, or for any other reason, please feel
free to ignore them. Apple and many other list maintainers have made
the digest form available to subscribers for good reason; I don't see
squeezing my comments in ahead of someone else's as sufficient reason
to switch.
Regards,
Jonathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
--
Mark J. Reed <
email@hidden>
_______________________________________________
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