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

Re: dynamic vs. static typing



[Steve Dekorte <steve@dekorte.com>]
> 
> On Nov 24, 2003, at 6:05 AM, Joe Marshall wrote:
> > The reason there are no `TRULY heterogeneous lists' is because it is
> > always possible to create a discriminated union type that covers all
> > elements.
> 
> Yes, and the only union may be introspection methods. In which case we 
> might be able to validly send any method that the introspection API 
> reveals to us, even though our type system (which restricted us to the 
> introspection methods) wouldn't allow it.
> 

Obviously, if this is a priority, then one would like the
introspection operations and the type system to work together in such
a way that this is allowed. Some sort of type-case form in the
language, along with anonymous interfaces, would seem to accommodate
this naturally. This is basically a type-safe cast, but with the
addition of anonymous interfaces and structural isomorphism, you could
cast a value to any interface that it matched, rather than only a
fixed set of declared interfaces.

Now, it's clear that if type system features like this prevent type
errors at runtime, they do so at the cost of making other run-time
errors more likely, since type-cases are (pretty much by definition
under an open-world assumption) non-exhaustive.

This brings up the question of what the difference really is between
"type errors" and other run-time errors (like pattern matching failure
in particular), but we've been over that...

Matt

-- 
Matt Hellige                  matt@immute.net
http://matt.immute.net