[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dynamic vs. static typing
"Anton van Straaten" <anton@appsolutions.com> writes:
> In fact, a question would arise if you *didn't* want to statically type such
> a list. What on earth would you want to do with it that involves knowing
> literally nothing about the types of the elements? If your answer is that
> you'll use introspection to figure out what to do with the objects, then
> that presumably implies that the objects support an introspection interface,
> and you can specify that as a type constraint.
Surely you can think of *something* other than simple destructuring!
What about `property lists' (alternating key and values) or
`association lists' (list of key/value pairs), or simple sets? All of
these are interesting sorts of objects, they may be heterogeneous, and
useful operations exist (assoc or member, for example) that do not
need to know the type of the object contained in the list.
What about representing a matrix as a list of lists? Transposing such
a thing doesn't require knowledge of the types involved, but it can be
useful. Things like the `wedge product' from exterior algebra (thanks
to Greg Pettyjohn for showing me this) don't require the object types
to be known.