Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!rochester!pt.cs.cmu.edu!LINDENTHAL.CAE.RI.CMU.EDU!jwb From: jwb@LINDENTHAL.CAE.RI.CMU.EDU (John Baugh) Newsgroups: comp.lang.pascal Subject: Re: C Ternary Conditional Expression? Message-ID: <5073@pt.cs.cmu.edu> Date: 26 May 89 20:32:55 GMT References: <950025@hpclcdb.HP.COM> <6490002@hplsla.HP.COM> <1344@ruuinf.cs.ruu.nl> Organization: Carnegie-Mellon University, CS/RI Lines: 22 In article <1344@ruuinf.cs.ruu.nl> verwer@ruuinf.cs.ruu.nl (Nico Verwer) writes: [stuff deleted] >in your program? 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. I think this (i.e., a preference for one or the other) is a philosophical issue. Some like to separate "statement-like" phrases from "expression-like" ones, allowing side-effects only in statements. That is, statements are for changing state, expressions for computing values from states. This way of looking at things actually simplifies correctness arguments, in particular, non-interference specifications. [stuff deleted] John Baugh --