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=0000ffaaaaff|Soft
|bgcolor=00ee00aaeeaa|MeekWeak
|bgcolor=dddd00ffee99|WeakMeek
|bgcolor=cc8800ffcc99|Firm
|bgcolor=bb0000ffcccc|Strong
|-
!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=0000ffaaaaff rowspan=4 width="50px"| deproc- eduring
|bgcolor=00ee00aaeeaa rowspan=3 width="50px"| all '''soft''' then weak deref- erencing
|bgcolor=dddd00ffee99 rowspan=2 width="50px"| all '''weak''' then deref- erencing
|bgcolor=cc8800ffcc99 rowspan=1 width="50px"| all '''meek''' then uniting
|bgcolor=bb0000ffcccc width="50px"| all '''firm''' then widening, rowing and voiding
|colspan=1 bgcolor=bb0000ffcccc|
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=cc8800ffcc99| Example:
<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=dddd00ffee99|Examples:
<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=00ee00aaeeaa|Examples:
<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=0000ffaaaaff| Example:
* deproceduring of: <lang algol68>PROC REAL random: e.g. random</lang>
|}
3,037

edits