[e-lang] Disabling Implicit Guards

Mark S. Miller e-lang@mail.eros-os.org
Sun, 16 Jun 2002 00:08:09 -0700


Another draft note of a resolution for the next release:

                       Disabling Implicit Guards

This release introduces the three properties

    e.enable.implicit-final-guard
    e.enable.implicit-var-guard
    e.enable.implicit-result-guard

All of whom are set to true by default. 

In reaction to the bug "need type guard on data from renderer" 
http://bugs.sieve.net/bugs/?func=detailbug&bug_id=125519&group_id=16380 , 
these three switches exist so an individual module may elect to turn them 
off for itself, forcing itself to be more explicit.

When on, the corresponding guard declarations may be omitted, in which case 
a default guard is provided. When off, those guard declarations must always 
be explicitly provided. The official E language allows all these kinds of 
guards to be omitted, and therefore these switches must be 'true' by default.

Note that the definition of an object name in an object definition 
expression does not allow a guard, so none of these switches will cause one 
to be required there.

As with all pragmas, these pragma switches are not part of the official E 
language. In fact, we expect to retire these switches and migrate the 
ability to ask for this extra check into an advisory static checker. 

These switches are demonstrated by the following example session:

    ? pragma disable("implicit-final-guard")
    ? pragma disable("implicit-var-guard")
    ? pragma disable("implicit-result-guard")
 
    ? def x := 3
    # syntax error: The optional e.enable.implicit-final-guard \
    #               feature in eprops.txt is currently off.
    # def x := 3
    #        ^
 
    ? def x :integer := 3
    # value: 3


----------------------------------------
Text by me above is hereby placed in the public domain

        Cheers,
        --MarkM