Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ReExplanation of (x<y<z)

1 view
Skip to first unread message

D...@psuvma.bitnet

unread,
Oct 13, 1986, 10:21:11 AM10/13/86
to

Sorry I guess the question wasn't which languages support it, but why
most of the major ones don't?


Isn't it a direct translation from
if (x<y<z) then ... to ... if (x<y) and (y<z) ...

Thus the optimization arguement isn't valid.

One grows tired of writing,

if (thepoint[xdir,ydir].threepoint.x < 5) and
(thepoint[xdir,ydir].threepoint.x > 1) then

or some similarly boolean expression.

dave brosius

Wayne A. Christopher

unread,
Oct 15, 1986, 4:41:49 PM10/15/86
to
In article <7871DMB@PSUVMA>, d...@psuvm.bitnet.UUCP writes:
> Sorry I guess the question wasn't which languages support it, but why
> most of the major ones don't?

I think it is a matter of clean expression semantics -- 'x < y' has a value
which is a boolean, and so '(x < y) < z' doesn't mean what it should mean.
Another (tertiary) operator would do the job, as would

#define between(x, y, z) (((x) < (y)) && ((y) < (z)))

but I imagine that for the languages that do allow x < y < z, a large reason
why they aren't 'major' is that they are careless of semantic clarity and
orthagonality.

Wayne

Wayne A. Christopher

unread,
Oct 17, 1986, 5:09:43 PM10/17/86
to
In article <7871DMB@PSUVMA>, d...@psuvm.bitnet.UUCP writes:
> Sorry I guess the question wasn't which languages support it, but why
> most of the major ones don't?

I think it is a matter of clean expression semantics -- 'x < y' has a value

Frank Adams

unread,
Oct 24, 1986, 3:06:13 PM10/24/86
to
In article <3...@ndmce.uucp> fau...@ucbcad.UUCP writes:
>I imagine that for the languages that do allow x < y < z, a large reason
>why they aren't 'major' is that they are careless of semantic clarity and
>orthagonality.

Whether you like it or not (I don't), COBOL is certainly a major language.
Nor is C, for example, especially careful about semantic clarity and
orthogonality -- consider pointers and arrays. I suspect the real reason is
that it makes writing the compilers slightly easier. (And I do mean
slightly -- this feature is not really hard to support.)

Frank Adams ihnp4!philabs!pwa-b!mmintl!franka
Multimate International 52 Oakland Ave North E. Hartford, CT 06108

0 new messages