[Types-sig] PyDL RFC 0.02

Greg Stein gstein@lyra.org
Tue, 28 Dec 1999 01:22:26 -0800 (PST)


On Tue, 28 Dec 1999, Paul Prescod wrote:
> Greg Stein wrote:
> > Nope. It sounded like Paul was suggesting different formats, suffixes, and
> > purpose. I don't think we should go that route.
> 
> One format. One purpose. Two suffixes. Two maintenance strategies.

Fine. It just didn't sound like that in your proposal, so I was concerned.

> > It would seem best to have a .pyi file that a human can craft and
> > maintain. It would be quite easy to have the type-check mode warn the user
> > that they haven't declared some interface or something (so they can go
> > and add it in). Heck, maybe the
> > user did that on purpose, because the class isn't public. It would also be
> > quite possible to invoke the type-checker with a mode that says "generate
> > a .pyi file for me." The user can then edit the thing as needed.
> 
> But the whole point is that we don't want to be forced to maintain the
> thing in a separate file.

I totally agree here.

> If you want to put some or all of the
> declarations in your source file then we need a place to extract those
> to.

While true, I could just as easily argue that they should be stored as
pickles in a central database.

It might be nice to start very simple: there is one file that we look for
(a .pyi). Whether that was hand-created or computer-created, we just don't
care. The file would be used for accessing a module's interface without
needing to actually load the module. In a type-check mode, it can be
verified against declarations (if any) in the source module.

> I could have just banished in-file declarations but it seemed that
> we could easily extract them so why not allow the convenience?

Euh... How could you have "just banished in-file declarations" ??

> > I also think that we'd want to avoid "combining the declarations" of two
> > files. Again, the user may not want the second group of declarations. 
> 
> Then they shouldn't put declarations in their Python file.

I do not believe this is a valid position. Specifically: I would put all
the declarations inline. If I create a .pyi, it would simply be as an
extract from the inline declarations *or* to create a public subset of the
items in the source file. Your scheme would mean that I couldn't use the
type stuff internally -- it would be exposed through the automagic
generated portion.

> > And
> > the combination rules might be a bit hard to describe or handle (from the
> > human's standpoint).
> 
> It's just concatenation! There is nothing hard about it.

It doesn't seem to be simple concatenation. How are conflicts handled? How
are merges done? e.g. a method is not declared in the interface file, but
it does have a declaration in the source.

Cheers,
-g

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