[Types-sig] check.py (was: PyDL RFC 0.02)

Paul Prescod paul@prescod.net
Wed, 29 Dec 1999 11:49:28 -0500


Greg Stein wrote:
> 
> ...
> 
> To do this, I would need to change the Python grammar, or suck in .pyi
> files. I plan to do the latter once some kind of formal grammar is
> specified. If that doesn't happen soon, then I'll be using the grammar
> that I posted in my type-proposal.html. It is complete and is sufficient
> (yet Paul seems to be starting from scratch... :-( ).

My syntax is mostly based on your web page. I switched "!" for "as"
based on my belief that it isn't Pythonic to use random keyboard
characters in ways that are not universally understood. And I put decl
and typedecl at the front instead of making them operators because I
agree with Tim Peters that we are designing a sub-language that needs to
be understood as being separate by virtue of being evaluated BEFORE the
code is executed.

It is my personal opinion that the grammar should be the last thing you
integrate into your system. In order to avoid maintaining a whole
compiler while the grammar shifts, I would suggest you define classes
like this:

class ParameterizedInterface:
	....

class ConcreteInterface:
	....

class MethodSignature:

and so forth. You need these classes regardless.

Then your interface file becomes:

Array = new ParamterizedInterface( 
	parameters=["elements", "array"],
	attributes=[new MethodSignature( arguments=... )]
  )

We need this API anyhow so it would help alot if you could design it
while you are writing your package.

 Paul Prescod