Formal Declarer

Meaning

A formal declarer specifies the mode of the value being ascribed in an identity declaration. It appears on the left hand side of an identity declaration, before the defining identifier. For example, in the following identity declaration the formal declarer is the mode indication real:

real pi = 3.141592;

Formal declarers also appear in routine texts as the modes of formal parameters, which shouldn’t be surprising, since the mechanism of associating formal parameters with actual parameters in a routine call is the identity declaration: during a function call the internal values provided in the call get ascribed to the formal parameters. For example, in the following routine the mode indications ref tree and []int are formal declarers:

proc set tree weights = (ref tree node, []int weights) void:
begin
  ...
end

The mode specified in a cast is also a formal declarer. In the following example, where a cast is used in the firm context of an operator, the formal declarer is real:

c := real (2) * pi * r;

Note that (unlike actual declarers) formal declarers of row modes do not include bounds. If bounds are provided they are ignored, although some implementation may offer checking the bounds at run-time as a security measure. This could be particularly useful in formal parameters, where the run-time check would make sure multiples of the expected bounds get passed to the routine.

Syntax

Simplified [RR 4.4.1.c] (formal declarer in identity declaration):

A) MODINE :: MODE ; routine.

c) identity definition of MODE TAG:
     MODE defining identifier with TAG, is defined as token,
     source for MODINE.

Simplified [RR 4.6.1.r] (formal declarer in formal parameter):

r) MODE parameter joined declarer:
     formal MODE declarer.

Simplified [RR 5.5.1.a] (formal declarer in cast):

a) MOID cast:
     formal MOID declarer, strong MOID ENCLOSED clause.

In 4.4.1.c the formal declarer is the MODE before the defining identifier.

Note that is defined as token is the equal sign character in the standard representation.

See Also