Previous

PART III Context Dependence

{This Part deals with those rules which do not alter the underlying syntactical structure:

· the transformations of modes implicitly defined by the context, with their accompanying actions;

· the syntax needed for the equivalence of modes and for the safe application of the properties kept in the nests.}

6. Coercion

{The coercions produce a coercend from a coercee according to three criteria: the a priori mode of the coercend before the application of any coercion, the a posteriori mode of the coercee required after those coercions, and the syntactic position or "sort" of the coercee. Coercions may be cascaded.

There are six possible coercions, termed "deproceduring", "dereferencing", "uniting", "widening", "rowing" and "voiding". Each Coercion, except "uniting", prescribes a corresponding dynamic effect on the associated values. Hence, a number of primitive actions can be programmed implicitly by coercions.}

6.1. Coercees

{A coercee is a construct whose production tree may begin a sequence of coercions ending in a coercend. The order of (completion of) the elaboration of the coercions is therefore from the coercend to the coercee (hence the choice of these paranotions). For example, i in REAL(i) is a coercee whose production tree involves 'widened to' and 'dereferenced to', in that order, in passing from the coercee to the coercend. Note that the dereferencing must be completed before the widening takes place.

The relevant production tree (with elision of 'NEST', 'applied' and 'with TAG', and with invisible subtrees omitted) is:

}

6.1.1. Syntax

A) STRONG{a,66a } :: FIRM{B}; widened to{65a,b,c,d } ; rowed to{66a} ; voided to{67a,b } .

B) FIRM{A,b} :: MEEK{c}; united to{64a } .

C) MEEK{B,c,d,62a ,63a,64a,65a,b,c,d} :: unchanged from{f}; dereferenced to{62a } ; deprocedured to{63a } .

D) SOFT{e,63b } :: unchanged from{f}; softly deprocedured to{63b } .

E) FORM :: MORF ; COMORF.

F) MORF :: NEST selection ; NEST slice ; NEST routine text ; NEST ADIC formula ; NEST call ; NEST applied identifier with TAG.

G) COMORF :: NEST assignation ; NEST identity relation ; NEST LEAP generator ; NEST cast ; NEST denoter ; NEST format text.

a) strong MOID FORM coercee{5A,B,C,D ,A341i} : where (FORM) is (MORF), STRONG{A}; MOID MORF ; where (FORM) is (COMORF), STRONG{A}; MOID COMORF, unless (STRONG MOID) is (deprocedured to void).

b) firm MODE FORM coercee{5A,B,C,D ,542c} : FIRM{B} MODE FORM.

c) meek MOID FORM coercee{5A,B,C,D } : MEEK{C} MOID FORM.

d) weak REFETY STOWED FORM coercee{5A,B,C,D } : MEEK{C} REFETY STOWED FORM, unless (MEEK) is (dereferenced to) and (REFETY) is (EMPTY).

e) soft MODE FORM coercee{5A,B,C,D } : SOFT{D} MODE FORM.

f) unchanged from MOID FORM{C,D,67a,b } : MOID FORM.

g) *SORT MOID coercee : SORT MOID FORM coercee{a,b,c,d,e}.

h) *MOID coercend : MOID FORM. {Examples:

}

a)
3.14 (in x := 3.14)
b)
3.14 (in x + 3.14)
c)
sin (in sin(x))
d)
x1 (in x1 [2] := 3.14)
e)
x (in x := 3.14)
{For 'MOID FORM' (rule f), see the cross-references inserted in sections 5.1.A, B, C, D before "coercee". Note, however, that a 'MOID FORM' may be a blind alley. Blind alleys within this chapter are not indicated.}

{There are five sorts of syntactic position. They are:

· "strong" positions, i.e., actual-parameters, e.g., x in sin(x), sources, e.g., x in y := x, the ENCLOSED-clause of a cast, e.g., (NIL) in REF BOOK(NIL), and statements, e.g., y := x in (y := x; x := 0);

· "firm" positions, i.e., operands, e.g., x in x + y;

· "meek" positions, i.e., enquiry-clauses, e.g., x > 0 in (x > 0 | x | 0), boundscripts, e.g., i in x1 [i], and the PRIMARY of a call, e.g., sin in sin(x);

· "weak" positions, i.e., the SECONDARY of a selection and the PRIMARY of a slice, e.g., x1 in x1 [i];

· "soft" positions, i.e., destinations, e.g., x in x := y and one of the TERTIARYs of an identity-relation, e.g., x in xx :=: x.

Strong positions also arise in balancing {3.2.1.e }.

In strong positions, all six coercions may occur; in firm positions, rowing, widening and voiding are forbidden; in meek and weak positions, uniting is forbidden also, and in soft positions only deproceduring is allowed. However, a dereferenced-to-STOWED-FORM may not be directly descended from a weak-STOWED-FORM-coercee (rule d) for, otherwise, x := x1 [i] would be syntactically ambiguous (although, in this case, not semantically). Also, a deprocedured-to-void-COMORF may not be directly descended from a strong-void-COMORF-coercee (rule a) for, otherwise,

( PROC VOID engelfriet; PROC VOID rijpens = SKIP;
  engelfriet := rijpens; SKIP)
would be ambiguous.}
 
Next