On Wed, 21 Jan 2015 15:01:28 +0100, Bernd Oppolzer wrote: >... >No, the things I had in mind was the assignments including increment etc, >the things like A += expression; etc ... works with other kinds of >operators, too, of cours, not only addition. > ... But beware if you expect similar behavior from A <= expression.
>>> BTW: variable ++; is not still possible in PL/1 for several good reasons. >>> >> I'm naive. What's a good reason (other than economy of language design) >> for not providing "variable ++"? (And what of "++ variable"?) One >> possibility might be lexical ambiguity. > >Some speculation on my part: > >in C, everything is an expression; >a ++ and ++ a are two very different expressions, >and this idea does not fit well into the PL/1 spirit. > I guess I'm not a true believer. Yes, the ++ and -- operators have a side effect of modifying their operands. I don't find this particularly objectionable. "Ontogeny recapitulates phylogeny." A possible motivation for providing ++ and == as operators is that they were hardware instructions on some (early) computers. But not s/360, so they're absent from PL/I. Regrettably, in C not everything is an expression. I often wish I could use a block as an expression: V = { int I; ... } In Algol 68 a procedure declaration is merely an instance of use of a block as an expression. >The assignment a += 5; >in C is an expression, too (and may be assigned to other variables >and used, whereever expressions are allowed in C). > >But it is no problem to take this kind of syntax over to PL/1, >WITHOUT assigning a value to the assignment A += 5; >(that is: without violating the language). > Has PL/I no operators which modify their operands? >a = b = c; > >in C. > And, peculiarly, in Algol 68 "V := expression" is itself an expression with a value with value not "expression" but the L-value of V. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN