[Types-sig] Attributes proposal

Edward Welbourne Edward Welbourne <eddyw@lsl.co.uk>
Thu, 16 Dec 1999 19:35:55 +0000

> My proposal for handling attributes is this:

> An attribute's type can be declared. Writes to the attribute from the
> same module can be statically type checked (if requested). Writes to
> the attribute from other modules are checked at runtime. That way we
> can always know the type of the attribute value and can therefore make
> reasonable use of the attribute in statically type checked functions.

> Opinions?

Sounds like a good way to cut that pie.
At least for modules, also for classes within a module (at outer scope).
For a class defined in the body of a function, ... hmm ... the right
scope in which to static-check is the function, anything else in the
module is outside (i.e. runtime-check).

For (attributes of) an instance of a class, we seem to have a messier
situation (its class may have lots of bases in lots of files ...
so which module is playing as host ?).
Did you intend this to apply to instances ?
If so how ?

Or did you intend to apply this only to attributes of modules ?

Sometimes a package might want to modify its submodules and have such
activity included in the static checking ... but punting on that sounds
reasonable at this stage.