14.225 Use of ambiguous construct

Prev Up Next Page 696 of 800 Search internet

Origin: lgc. Landing-place: terminal.

The body of an lgs source text uses a construct which could refer to more than one operator. As an example, suppose a page P references two pages P1 and P2 which both define an xyz construct. If the xyz construct occurs in the body of P, then lgc will complain about 'use of ambiguous construct' when it translates P. Lgc will not care about the construct being ambiguous if it is not used.

As a countermeasure, page P could reference P1 and P2 like this:


Doing so, all constructs of P1 get a qualifier of abc and all constructs of P2 get a qualifier of def. Thus, one can reference the xyz construct of P1 as abcxyz and the xyz construct of P2 as defxyz.

A downside of doing so is that all constructs of page P1 and P2 have to be qualified by abc and def, respectively. However, one can include an arbitrary list of qualifiers in a reference like this:


With the references above, one can reference xyz of P1 as abxyz, cdxyz, and efxyz. One can even include an empty qualifier. The empty qualifier has to come first:


With the references above, one can reference xyz of P1 as xyz, abxyz, cdxyz, and efxyz. Finally consider this example:


With the references above, one can reference xyz of P1 as abcxyz and xyz of P2 as defxyz. If one tries to use xyz then one will again get a message about use on an ambiguous construct.

With the references above, however, if only P1 defines an xxx construct and only P2 defines a yyy construct then one can reference the xxx construct as xxx or abcxxx and the yyy construct as yyy and defyyy. In other words, including the empty qualifier allows to reference all non-ambiguous constructs using their own name.

Note that if both P1 and P2 define a

   " + "

construct then one has to write e.g.

   1 abc+ 2

to add 1 and 2 using the plus construct of P1. That is so because the qualifier is inserted different places depending on how the construct starts. The rule essentially is: If the construct starts with a double quote and a space, the qualifier is inserted after the space. Else if the construct starts with a double quote, the qualifier is inserted after the double quote. Else the qualifier is prepended. For more details see the section on 'Qualified constructs' on the lgc page.

Prev Up Next Page 696 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05