[Types-sig] Module Attribute visibility

Skip Montanaro skip@mojam.com (Skip Montanaro)
Fri, 17 Dec 1999 11:40:29 -0600 (CST)

    Paul> Greg Stein wrote:
    >> IMO, let's solve static type checking. Leave visibility and
    >> modification rules to another phase. They are orthogonal problems,
    >> and we would do well to reduce our problem set (and the amount of
    >> discussion thereby engendered (my 25 cent word for the day :-)).

    Paul> They are not orthogonal at all. I can't statically check a file
    Paul> that uses sys.version unless I know that sys.version has not been
    Paul> overwritten with a string. We can't allow the runtime system to
    Paul> violate the expectations of the static type engine. We also don't
    Paul> want every user of sys.version to need to assert its type.

Depending what version of Python we are proposing this for, I think you can
punt on the issues of visibility and modification if you allow the
programmer to state (perhaps with a command line argument) that the elements
of all core modules (sys, os, posix, math, ...) have stable type
representations.  This allows you (us?) to write a set of declarations for
these modules akin to function prototypes in C or class declarations in C++.
If that doesn't leave enough wiggle room for some objects, perhaps you need
an "Object" declaration that tells the type checker the object is of an
indeterminate (my 25-cent word for the day) type.