Path: utzoo!utgpu!watmath!att!cbnewsc!nevin1
From: nevin1@cbnewsc.ATT.COM (nevin.j.liber)
Newsgroups: comp.lang.misc
Subject: Re: What I'd really like to see in an if-statement...
Message-ID: <2451@cbnewsc.ATT.COM>
Date: 16 Aug 89 01:14:37 GMT
References: <178@enea.se>
Reply-To: nevin1@ihlpb.ATT.COM (nevin.j.liber)
Organization: AT&T Bell Laboratories
Lines: 37

In article <178@enea.se> sommar@enea.se (Erland Sommarskog) writes:

>Actually I have always been surprised that no language I have dealt
>have had this feature since it is so easy to implement. Am I overlook-
>ing something?

There are a few things.  In evaluating the following expression:

	a < b < c < ... < n

where a,b,c,...,n are arbituary EXPRESSIONS which *may have side effects*
(something which mathematicians using this notation don't normally deal
with), these are some of the issues which arise:

Is the order of evaluation left to right, right to left, or arbituary?

If "a < b" is false, is c necessarily still evaluated?

Are a,b,c,...,n each evaluated only once, at most once, or as many
times as necessary?


The answers to these questions have a profound effect on the spirit of
the language, the style of code written in the language, the
implementation of the language, the possible optimisations for the
language, etc.  Different languages will have different answers
to these questions (as well as the question "Does this construct really
fit in with the rest of the language?").  Although at a first pass it
is easy to implement, the real question becomes "Will this construct be
truly beneficial to the language?"  Or, rephrasing this question
pessimistically, "Overall, will this construct be detrimental to the
language?"
-- 
 _ __	NEVIN ":-)" LIBER  nevin1@ihlpb.ATT.COM  (312) 979-4751  IH 4F-410
' )  )			 "We are almost into the '90s; *nothing* is wierd."
 /  / _ , __o  ____	   -- Buzz Kelman, Newsman & Bluesman, WLUP, 7/28/89
/  (_