Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!ames!elroy!ucla-cs!uci-ics!milne From: milne@ics.uci.edu (Alastair Milne) Newsgroups: comp.lang.pascal Subject: Re: C Ternary Conditional Expression? Message-ID: <15926@paris.ics.uci.edu> Date: 27 May 89 03:59:59 GMT References: <950025@hpclcdb.HP.COM> <6490002@hplsla.HP.COM> <1344@ruuinf.cs.ruu.nl> Sender: news@paris.ics.uci.edu Reply-To: Alastair Milne Distribution: na Organization: Educational Technology Center, Dept. of ICS, UC Irvine Lines: 20 >... Personally, I would like to write the above as > > a[ IF index = last_index THEN last_val ELSE f(index) ] := a[ y ] ; > >This would extend the IF-statement to conditional expressions, which in my >view is a higher-level construct than the conditional statement in Pascal, >because it allows one to write better readable code. Even putting complicated indexing expressions into []'s is enough seriously to compromise readability. Having an entire statement lodged in them seems to me even worse. The contention that this code is more readable seems to me quite unsupported. Years ago, ALGOL allowed IF's to return a value, and one could construct just this sort of thing. Wirth, apparently deliberately, left it out of Pascal. Before we start wishing to have it back, let's find out why it has been avoided. Alastair Milne