G
glen herrmannsfeldt
(snip, I wrote)
It has been a long time since I wrote ALGOL. Does it allow assignment
in places, such as inside and IF, where it might be confused for
a relational expression?
One that I do remember for ALGOL is that it uses IF THEN ELSE
for the conditional operator.
I := IF J>1 THEN 3 ELSE 4;
PL/I uses '0'B and '1'B, bit strings of length one. It allows
conversion beteen bit (or character) strings and numeric types,
though.
But also PL/I, like Fortran, has an assignment statement.
The = in assignment has a differnet meaning from = as a relational
operator. Multiple assignment is done with , not =.
-- glen
Java didn't invent this; algol68 has a distinct boolean type (although
I don't recall if this case is coercible) and does have nestable
assignment, but (canonically) using := which is harder to mistake.
It has been a long time since I wrote ALGOL. Does it allow assignment
in places, such as inside and IF, where it might be confused for
a relational expression?
One that I do remember for ALGOL is that it uses IF THEN ELSE
for the conditional operator.
I := IF J>1 THEN 3 ELSE 4;
Fortran>=77 also has boolean, as do Pascal and Ada, but they have (as
you noted) assignment as a statement not a (sub)expression, plus the
latter two use := . I don't know about the other Wirth languages.
The only non-C-family language I know to use integer 1/0 for boolean
is APL. FORTH uses integer nonzero/0 with a preference for -1 as the
nonzero, but FORTH is almost as typeless as BCPL, plus the syntax for
both assignment and if are radically different from C.
PL/I uses '0'B and '1'B, bit strings of length one. It allows
conversion beteen bit (or character) strings and numeric types,
though.
But also PL/I, like Fortran, has an assignment statement.
The = in assignment has a differnet meaning from = as a relational
operator. Multiple assignment is done with , not =.
-- glen