Category:ALGOL 68: Difference between revisions
→Coercion (casting): correct meek/weak headings and mute colours/colors for legibility
m (soft=blue, meek=green, weak=yellow, firm=orange, STRONG=red) |
(→Coercion (casting): correct meek/weak headings and mute colours/colors for legibility) |
||
Line 175:
!rowspan=2| Coercion examples
|-
|bgcolor=
|bgcolor=
|bgcolor=
|bgcolor=
|bgcolor=
|-
!S<br>
Line 197:
* All parts (but one) of a balanced clause
* One side of an identity relation, as "~" in: <lang algol68> ~ IS ~</lang>
|bgcolor=
|bgcolor=
|bgcolor=
|bgcolor=
|bgcolor=
|colspan=1 bgcolor=
Widening occurs if there is no loss of precision. For example: An INT will be coerced to a REAL, and a REAL will be coerced to a LONG REAL. But not vice-versa. Examples:
<lang algol68>INT to LONG INT
Line 222:
*Operands of formulas as "~" in:<lang algol68>OP: ~ * ~</lang>
*Parameters of transput calls
|colspan=3 bgcolor=
<lang algol68>UNION(INT,REAL) var := 1</lang>
|-
Line 235:
<lang algol68>FROM ~ BY ~ TO ~ WHILE ~ DO ... OD etc</lang>
* Primaries of calls (e.g. sin in sin(x))
|colspan=4 bgcolor=
<lang algol68>REF REF BOOL to BOOL
REF REF REF INT to INT</lang>
Line 246:
* Primaries of slices, as in "~" in: <lang algol68>~[1:99]</lang>
* Secondaries of selections, as "~" in: <lang algol68>value OF ~</lang>
|colspan=5 bgcolor=
<lang algol68>REF BOOL to REF BOOL
REF REF INT to REF INT
Line 257:
t
|| The LHS of assignments, as "~" in: <lang algol68>~ := ...</lang>
|colspan=6 bgcolor=
* deproceduring of: <lang algol68>PROC REAL random: e.g. random</lang>
|}
|