== vs =

David R. Linn vuse!ee5!drl at uunet.UU.NET
Sat Apr 2 10:00:18 AEST 1988


Recently, Frank Adams <franka at mmintl.uucp> wrote:
>I want to keep = and == with almost exactly the same syntax as they have
>now.  The only difference is that = does not have as its value the result of
>the assignment; instead its value is void.  A new operator, perhaps :=,
>should be introduced, which has exactly the definition that = has now.

and

>This could actually be introduced into C over a period of years.  The first
>step is to introduce the new assignment operator, continuing to support use
>of the result of an = assignment as an obsolete feature.  At some later
>point, this could be phased out.
     
>In any event, I would like to see something like this in D (if that ever
>happens).

To me, it would seem more appropriate to change the "is-equal-to" operator
*in D* from "==" to something like "?=" which 

1) emphasizes the "testing nature" of the operator,
2) is less likely to be confused (visually) with the assignment operator, and
3) avoid the situations of having two different assignement operators (one
with a value and one without.)

The need/desire for an assignment with a value is shown by the two common
idioms
1) a = b = c = INIT_VAL;
and
2) while ((ch = getchar()) != EOF && ch != '\n') {blah};

Also, by the nature of this response, please note that (I consider that)
this dicussion in becoming more D'ish in nature that C'ish. Maybe we need
a comp.lang.d/Info-D for these hypothetical discussions.
---------- David Linn -------------------------------------------------
INET:	drl at vuse.vanderbilt.edu [129.59.100.1]	
UUCP:	...!uunet!vuse!drl		CSNET:	drl at vanderbilt.csnet
AT&T:	(615)322-7924			BITNET:	linndr at vuengvax
USPS:	P.O. Box 1804, Vanderbilt University, Nashville, TN, USA, 37235



More information about the Comp.lang.c mailing list