Re: First language with conditional assignment?

"Bartc" <bc@freeuk.com>
Mon, 7 Mar 2011 15:32:15 -0000

          From comp.compilers

Related articles
[7 earlier articles]
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)
Re: First language with conditional assignment? alex.colvin@valley.net (mac) (2011-03-07)
Re: First language with conditional assignment? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-07)
Re: First language with conditional assignment? robin51@dodo.com.au (robin) (2011-03-08)
Re: First language with conditional assignment? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-08)
| List of all articles for this month |

From: "Bartc" <bc@freeuk.com>
Newsgroups: comp.compilers
Date: Mon, 7 Mar 2011 15:32:15 -0000
Organization: A noiseless patient Spider
References: 11-03-006 11-03-014
Keywords: syntax, history
Posted-Date: 07 Mar 2011 11:56:01 EST

"robin" <robin51@dodo.com.au> wrote in message
>
>>Does anyone know what the earliest languages supporting conditional
>>assignment were?
>
> There's Algol from c. 1960, with things like:
>
> a := if e > f then b else c;
>
> As for me, I don't like conditional assignments,
> much preferring the traditional form --
>
> if e > f then a := b else a := c;


Neither of those look like conditional assignments to me. Both seem to be
unconditional assignments, so that a ends up with a new value (b or c) in
either case.


(The if e>f bit is just a form of expression, which could just as well
appear anywhere else.)


However, I can't offer an alternative syntax other than:


  if e>f then a:=b


which, written perhaps as:


  (e>f | a:=b)


can't get much that much more compact.
--
Bartc
[See the Icon example. -John]



Post a followup to this message

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