[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 14:54:55 -0700
- Sender: address@hidden
- Thread-index: AcIGjppDxxoyOPB3Qh+n7HhWRvpCNQAAKRlg
- Thread-topic: orthogonality and generalized references (was Re: Zen of Python)
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.
Cheers,
Todd
-----Original Message-----
From: Guy Steele - Sun Microsystems Labs [mailto:Guy.Steele@sun.com]
Sent: Tuesday, May 28, 2002 2:28 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)
Excellent analysis, Todd; thank you. Now let us contemplate the even
more subtle contrast, in Icon, between
/dict["foo"] := \dict["bar"]
and
/dict["foo"] := dict["bar"]
Gee1 This is almost as much fun as nested backquotes! :-)
--Guy