[Types-sig] Re: syntax and compile/run -time

scott scott@chronis.pobox.com
Tue, 4 Jan 2000 22:42:40 -0500


On Tue, Jan 04, 2000 at 07:17:22PM -0800, Greg Stein wrote:
> On Tue, 4 Jan 2000, Paul Prescod wrote:
> > John Ehresman wrote:
> > > ...
> > > It would also be nice to be able to examine the interface of an object
> > > through the native reflection API.  I don't know if these considerations
> > > requre that type objects be constructable at runtime because python source
> > > could be generated and the compiled on the fly, but I think they serve as
> > > examples of why the type system should be extensible at runtime.
> > 
> > We all agree that interfaces should be constructible at runtime. What we
> > disagree on is whether runtime constructed interfaces can be used in the
> > same syntactic contexts as statically constructed interfaces.
> > 
> > a = GoFetchMeAnInteface()
> > decl foo as def( arg: a ) -> String
> > 
> > interface B( a ):
> > 	...
> > 
> > ...and so forth. I claim that the syntax should restrict us to clearly
> > separating the runtime from the compile time.
> 
> Maybe it goes with saying, but I'm on the opposite fence from Paul :-)
> 
> I don't think we should restrict the runtime from using any [new] Python
> syntax. The above code should be completely legal and valid, but it would
> not be compile-time checkable.


one thing that bothers me about this is that the line 'decl foo as
...' may be somewhere completely different than the 'a = ...' line,
and so it becomes unclear what is meant by the programmer.

one possible solution to that clarity is something like this:

a = GoFetchMEAnInterface()
decl foo as def( arg: a ) -> String

is an error (at compile time) , but

a = GoFetchMEAnInterface()
decl foo as runtime def( arg: a ) -> String

is ok at compile time, but may or may not cause an error at runtime.

I'm not against keeping the same basic syntax, but I do believe it
should be made clear *in the decl statement* that it is not intended
to be part of the compile-time stuff.  If the programmer indeed
intends that (and they really might), they need to be told about it in
a way that is more obvious than a warning.

scott

scott