Re: First language with conditional assignment?

Stefan Monnier <monnier@iro.umontreal.ca>
Sat, 05 Mar 2011 13:44:54 -0500

          From comp.compilers

Related articles
First language with conditional assignment? compilers@is-not-my.name (2011-03-03)
Re: First language with conditional assignment? nmh@t3x.org (Nils M Holm) (2011-03-04)
Re: First language with conditional assignment? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-04)
Re: First language with conditional assignment? cr88192@hotmail.com (BGB) (2011-03-04)
Re: First language with conditional assignment? kym@kymhorsell.com (2011-03-05)
Re: First language with conditional assignment? robin51@dodo.com.au (robin) (2011-03-05)
Re: First language with conditional assignment? news@cuboid.co.uk (Andy Walker) (2011-03-05)
Re: First language with conditional assignment? monnier@iro.umontreal.ca (Stefan Monnier) (2011-03-05)
Re: First language with conditional assignment? derekrss@yahoo.ca (Derek) (2011-03-06)
Re: First language with conditional assignment? compilers@is-not-my.name (2011-03-07)
Re: First language with conditional assignment? compilers@is-not-my.name (2011-03-07)
Re: First language with conditional assignment? compilers@is-not-my.name (2011-03-07)
Re: First language with conditional assignment? neitzel@gaertner.de (2011-03-07)
Re: First language with conditional assignment? bc@freeuk.com (Bartc) (2011-03-07)
[4 later articles]
| List of all articles for this month |
From: Stefan Monnier <monnier@iro.umontreal.ca>
Newsgroups: comp.compilers
Date: Sat, 05 Mar 2011 13:44:54 -0500
Organization: A noiseless patient Spider
References: 11-03-006 11-03-014
Keywords: syntax, history
Posted-Date: 06 Mar 2011 13:44:00 EST

> As for me, I don't like conditional assignments,
> much preferring the traditional form --


> if e > f then a := b else a := c;


It's very sad that programmers are trained to artificially separate the
world into "statements" and "expressions" and hence end up, as above,
preferring the less precise and more redundant form.
To me


    a := if e > f then b else c;


has various advantages, e.g.:
- common subexpression elimination.
- make it blatantly obvious that this whole thing sets `a' without
    having to check what each branch does.




                Stefan


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.