What I'd really like to see in an if-statement...

Peter da Silva peter at ficc.uu.net
Mon Aug 7 22:09:11 AEST 1989


In article <5024 at alvin.mcnc.org>, spl at mcnc.org (Steve Lamont) writes:
> 	if ( foo < bar < baz )

> Is there any reason why such a construction is not practical?

It complicates the language design for the sake of adding syntactic
sugar, but otherwise it's eminently practical.

> If not, why has
> no language (that I am aware of or can program in) implemented such a
> construction?  Good idea or bad idea?

Well, languages don't implement constructs, but semantic quibbling aside
the real-time control language Bob Pearson designed and I implemented at
Hydril Control Systems (for a product that was later dropped) had such
a construct. It was fairly easy to implement, at least in the Forth-based
recursive-descent parser I wrote.
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Business: peter at ficc.uu.net, +1 713 274 5180. | "The sentence I am now
Personal: peter at sugar.hackercorp.com.   `-_-' |  writing is the sentence
Quote: Have you hugged your wolf today?  'U`  |  you are now reading"



More information about the Comp.lang.c mailing list