[Types-sig] New syntax?
Paul Prescod
paul@prescod.net
Mon, 20 Dec 1999 07:55:42 -0600
Greg Stein wrote:
>
> ...
>
> Nah. No execution needs to take place. Just some data flow analysis.
Let's be concrete:
1.
if somefunction():
class a:
def b(self)->String: return "abc"
else:
class a:
def b(self)->Int: return 5
How many type objects are created? What are there names? What is the
type of a?
2.
class a:
def b(self)->String: return "abc"
for i in sys.argv:
class a:
def b(self)->Int: return 5
3.
def makeClass():
class a:
def b( self ):
return "abc"
return a
j=makeClass()()
--------------------
This seems intractable to me. I got around this in my original proposal
by requiring all declaring classes to be *top-level*. In other words I
formally defined the subset of Python that does not require code
execution. If you can formally define the semantics of "data flow" then
I will be able to compare the proposals.
Note that I am half-way between you and Tim. I think that type objects
should be more like Python objects but I am willing to restrict where
they are created to make the problem tractable and the semantics
understandable.
--
Paul Prescod - ISOGEN Consulting Engineer speaking for himself
The occasional act of disrespect for the American flag creates but a
flickering insult to the values of democracy -- unless it provokes
America into limiting the freedoms that are its hallmark.
-- Paul Tash, executive editor of the St. Petersburg Times