[Types-sig] Re: Conformance model
skaller
skaller@maxtal.com.au
Fri, 31 Dec 1999 05:53:17 +1100
Paul Prescod wrote:
>
> skaller wrote:
> >
> > ...
> >
> > Given that python is dynamic,
> > my argument is that, say, for a type error,
> > it might make sense to ... mandate that
> >
> > def f(x):
> > 1 + "Hello"
> >
> > is not a valid Python program -- a compiler
> > can reject the program, rather than being
> > forced to implement:
> >
> > def f(x):
> > raise TypeError
> >
> > which is what is currently required.
>
> My feeling could be summed up thus:
>
> "The following actions are illegal. A Python compiler may report them
> and refuse to compile the program or it may run the program and generate
> some form of Error exception."
Seems fair ..
> I would only willing to go further if you would describe overwhelming
> optimization benefits in allowing undefined behavior.
How would you account for 'assert'? Assert provides
a run time test that can be optimised away, a compiler could
perhaps be permitted to report an error IF it could detect
one would occur -- but currently, there is no requirement
is actually generate an error, either at compile time
or run time: the current optimising compiler does neither.
> You are swimming against the tide of history here. Java doesn't have
> much undefined behavior either.
java and python are not ISO standardised.
C and C++ are, and allow undefined behaviour in some places,
because it is necessary for performance.
Pleny of people use C and C++ to write code. :-)
Plenty of people use python and java and wish they ran
faster.
--
John Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850