[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optional types

Eric Kidd wrote:
> 1) Every object belongs to a class.  Class membership--even for
> parameterized classes--can be tested in a handful of instructions. 

Here's the problem in the Python world. Python people are very used to
being able to say: okay, X is not *really* a Y, but it looks enough like
a Y to pass. Certainly this is common in any dynamically typed language.
Now imagine module implementor decides to define an interface using
static declarations for all of the maintenance and performance benefits.
All of a sudden, the programmer can't pull this looks-like-a trick

One approach is to go down the contraint path, but you lose O(1)
typecheck performance. Another approach is to have some kind of "trust
me" keyword but you force the programmer to add the keyword all over the
place. Yet another approach is to default to "trust me" but allow a
programmer to say that they WANT stricter checking (perhaps choosing
whether to do it dynamically or statically).

What do existing mixed-mode languages do to allow this style of

 Paul Prescod