[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


    I basically agree with you, but would like to point out one thing that I
    hadn't thought of until I read your mail just now.  Since a portable
    program cannot know what the upgraded element type is, it must not
    assume that all implementations have some objects that are members of
    the upgraded element type but not members of the exact declared type.
    This means that if it "is an error" for an array element not to be of
    the upgraded type, it also "is an error" for an array element not to be
    of the exact declared type; either way, a program that does that is not
    portable.  So the only real problem with Pierson's proposal is its
    proposed change of enforcement of type declarations from "is an error"
    to "signals an error".
    Now, if we make it "signals an error in the highest safety mode" then
    we're back with the same problem: does it signal an error when you
    violate the declared type, or only when you violate the upgraded type?
    The former provides a more portable definition of when errors are
    signalled, but violates the consistency of declaration with
    discrimination.  The latter keeps declaration and descrimination
    consistent, but means that there are some cases that "are an error" (or
    at least are not portable) in lower safety settings, but fail to "signal
    an error" in the highest safety setting.
The problem is that there are logically three types of declaration in
these cases: for discrimination, for declaration, and for reference.
For declaration refers to the array as a whole.  For reference refers
to references to array elements.  I claim that upgrading for reference
introduces a confusing and unnecessary incompatibility between array
elements and normal variables.  I also claim that there are people
writing and distributing code today who neither understand nor desire
this incompatibility.

This whole upgrading thing is a necessary hack to try an adopt an
abstract type system to a varying set of efficient implementations.
There is no reason why this hack needs to be propagated to references
to individual elements, which should follow the rules for "normal"
variables as much as possible.