[Types-sig] Module Attribute visibility

Greg Stein gstein@lyra.org
Thu, 16 Dec 1999 12:57:54 -0800 (PST)


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 :-)).

Really: please, can we table discussions on visibility and modification?

Cheers,
-g

On Thu, 16 Dec 1999, Paul Prescod wrote:
> Tim Peters wrote:
> > 
> > Resist the dubious temptation to conflate declaration with initialization,
> > and "an easy mechanical transformation to valid Python 1.5.x" consists of
> > commenting out the decl stmts!  Heck, call the keyword "#\s+decl\s+" and
> > it's a nop.
> 
> Okay, but doesn't Python already conflate declaration with
> initialization? When I refer to mymod.foo I am referring to an object
> that was assigned, somewhere to the name foo in the module mymod.
> 
> Are we going to say that statically type checked code can only refer to
> declared (not merely assigned) variables in other modules? Would it be
> safe to say that undeclared variables are simply not available for type
> checking?
> 
> Would you suggest that this is even the case for functions? I.e. 
> 
> def foo( str ): return str*2
> 
> is invisible to the type checker until we add:
> 
> decl foo: str -> str
> 
> Or would foo have an implicit declaration:
> 
> decl foo: PyObject -> PyObject
> 
> And if that foo has an implicit declaration, shouldn't this foo also:
> 
> foo = lambda x: x*2
> 
> 

-- 
Greg Stein, http://www.lyra.org/