Typing system vs. Java
aleaxit at yahoo.com
Mon Aug 6 17:07:30 CEST 2001
<mcherm at destiny.com> writes:
> Alex Martelli writes:
> > I don't request
> > a language that will in fact absolutely CHECK assertions containing
> > universal or existential quantifiers, nor one that will always be
> Alex, I strongly agree with your proposal that a language allow
> the expression of assertions which are STRONGER than what the
> language guarantees to deliver.
Great, that makes two of us!-)
> The closest thing I've found is programming by contract features
> in Eiffel, but that's really not perfect. I've always felt that
Agreed -- no quantifiers. But it IS a good thing that, although
the Eiffel *philosophy* is so strongly oriented to *compile-time*
checks, in fact all of the PbC stuff (which basically has to be
checked at *run* time, just about always) still IS in the language.
> I'll give another example of how I think it could be used. In
> And if you're starting with something like Python, than you can
> ONLY improve things... if the "hints" were implemented and then
> ignored (always using array-list), then we'd be exactly where we
> are right now, plus hints.
Yes, lovely idea. Actually, if the 'hints' were given in a formal
way to a factory-function, it *might* be possible for the function
to pick different kinds of containers -- and even if the function
(in the current implementation) ignored the hints and just served
a completely general container (Python list), no loss. But it
would be quite feasible to have debug-mode (factory function
serves up a UserList derivative that checks the hints are in
fact accurate and warns otherwise), fast-compile-mode (factory
function just serves up a list), optimize-mode (factory function
picks the right container based on the hints).
Now all we need is design a suitable hint-language and we can
> Anyway, I think that "compiler hints" are MORE useful in other
> places (like invariants, preconditions, etc) which are more
> useful overall and more easily ammenable to compile-time testing
> or debug-version testing, but this is an additional application
> of the concept that I just wanted to throw out there.
And very interesting BECAUSE it's reasonably easily prototypable
right now... I think next time I design a system that includes
factory functions I'll be thinking about a hint-language to go
with it, too:-).
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
More information about the Python-list