Assignment in test: OK?

Silver gaynor at sparky.rutgers.edu
Thu Sep 20 20:27:28 AEST 1990


gaynor at sparky.rutgers.edu (Silver, Moi) wrote:
> If I had my way, assignment would be `<-' and equality, `='.

news at macuni.mqcc.mq.oz (JamesPW) responds:
> So 
>	if (a<-1) {
>		...
>	}
> takes on a whole new meaning ... (and always succeeds!)

Yeah, longest token matched.  I kind of ignored syntactic ambiguity for the
purposes of the discussion.  Personally, I seperate operators of lower
precedences from their arguments, which would make your example would read "if
(a <- 1) ..." if assignment had been intended, and "if (a < -1) ..." if
less-than had been intended.  `<-' so much better connotes assignment than `='
that I'll stick to me guns here.  It's more important to me to get the
appearance of a left arrow; that the characters `<' and `-' happen to give this
appearance when the former immediately preceds the latter is a convenience.
(It's damn unfortunate that left- and right-arrows are not part of the ascii
character set.  They have enough meaning beyond any other graphical
connotations that a good case could be made for them.  But that's life.)

Not that ansi committees and compiler writers are not going to trip over
themselves in a flurry to accommodate a minority preference, hee hee!  But on a
more serious note, simple ol' cpp doesn't accommodate this user's preference
either.  Many'll say that it's not a good idea to modify the language with cpp.
Well, by writing functions and creating data types, one is enhancing (read
"modifying") the language.  I would take this further if I could without a
severe amount of effort.

subbarao at phoenix.Princeton.EDU (Kartik Subbarao) responds:
> My My -- You must be an S programmer, where <- IS the assignment operator.
> But now how do I say ``If a is less then -1''?

Above.

Yes, I've programmed in S.  However, I've held this opinion long before my
escapades with S.  I feel that S is a woof in many respects, but at least the
authors picked my preferred assignment operator appearance.

Regards, [Ag] gaynor at paul.rutgers.edu



More information about the Comp.lang.c mailing list