[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: orthogonality and generalized references (was Re: Zen of Python)
- To: "Guy Steele - Sun Microsystems Labs" <address@hidden>, <address@hidden>, <address@hidden>
- Subject: RE: orthogonality and generalized references (was Re: Zen of Python)
- From: "Todd Proebsting" <address@hidden>
- Date: Tue, 28 May 2002 15:12:39 -0700
- Sender: address@hidden
- Thread-index: AcIGk+l3cI2hrh7hQTeu6mSQu2G/fwAABKsA
- Thread-topic: orthogonality and generalized references (was Re: Zen of Python)
Yes, due to the success/failure difference, you are exactly correct that
the expressions below are not indistinguishable when they are used as
subexpressions. Bravo.
Humbly yours,
Todd
-----Original Message-----
From: Guy Steele - Sun Microsystems Labs [mailto:Guy.Steele@sun.com]
Sent: Tuesday, May 28, 2002 3:06 PM
To: Guy.Steele@sun.com; kragen@pobox.com; ll1-discuss@ai.mit.edu; Todd
Proebsting
Subject: RE: orthogonality and generalized references (was Re: Zen of
Python)
Date: Tue, 28 May 2002 14:54:55 -0700
From: "Todd Proebsting" <toddpro@microsoft.com>
Thank you, Guy, for omitting the "Why didn't you enumerate all *four*
possibilities?" that others less kind might have asked pointedly. I
will enumerate all four, leaving the two you discuss below adjacent.
WITH GOAL-DIRECTION WITHOUT GOAL-DIRECTION
dict["foo"] := dict["bar"] dict["foo"] := dict["bar"]
dict["foo"] := \dict["bar"] tmp := dict["bar"]
if tmp is not null then
dict["foo"] := tmp
/dict["foo"] := dict["bar"] lval := lvalueOf(dict["foo"])
if rvalueOf(lval) is null then
tmp := dict["bar"]
rvalueOf(lval) := tmp
/dict["foo"] := \dict["bar"] lval := lvalueOf(dict["foo"])
if rvalueOf(lval) is null then
tmp := dict["bar"]
if tmp is not null then
rvalueOf(lval) := tmp
To me, the difference between the last two is *less* clear when
written
without the unary operators (right column) because the second null
test
is lost in a sea of characters. With the unary operators and GD
(left
column), it's clear that the difference is whether or not a null
value
can be assigned to the (previously null) left-hand side. I consider
this an example of why concise/succinct/terse languages can be
clearer
than less concise languages. It's a balance.
Of course, what makes Guy's example "subtle" is that a little
reasoning
about the values involved indicates that the two are behaviorally
indistinguishable.
But what makes it even more subtle, if I understand
correctly, is that *in Icon* they are not behaviorally
indistinguishable, precisely because when the left-hand side and
right-hand side are both null,
/dict["foo"] := dict["bar"]
*succeeds* (and overwrites a null with a null) but
/dict["foo"] := \dict["bar"]
*fails*, and that could affect the further control flow of an Icon
program containing such a statement, right?
--Guy