[Types-sig] New syntax?

Greg Stein gstein@lyra.org
Mon, 20 Dec 1999 01:20:22 -0800 (PST)


On Sun, 19 Dec 1999, Tim Peters wrote:
>...
> [GregS]
>...
> > decl foo: Any
> > decl bar: String
> >
> > The compiler isn't going to have recognized names for the types.
> 
> I pushed almost everything into "decl" stmts so that type specification
> really was a sublanguage distinct from current Python, and specifically a
> declarative  (no control flow of its own & no side-effects) sublanguage,
> fully evaluable at compile-time via simple means.  To the extent that that's
> true, it can enjoy its own "compile time" namespace distinct from the
> runtime namespaces, and Int, Any, String, Boolean ... can be decreed to
> "just be there", by magic, *in* declarations, for purposes of compile-time
> type checking.

Ack. Now you're talking about a whole new set of names to introduce to the
language. I think that is a Bad Thing.

I can understand the desire to simplify the task for the compiler, but
creating a distinct, partitioned namespace is just that. It doesn't mesh
well into Python itself.

> If instead we have to interpret imports and binding stmts
> and attribute dereferences and ... to get at names for types, we pretty much
> have to *execute* the code -- and Guido won't go for that.  Or, if he does,
> he shouldn't <wink>.  The "static" in "static typing" has implications.

Nah. No execution needs to take place. Just some data flow analysis. And
thankfully, Python doesn't have "goto" ... the hardest control structure
to model is try/except. The others are pretty basic.

Cheers,
-g

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