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

Re: dynamic vs. static typing



Russ Ross <rgr22@cl.cam.ac.uk> writes:

> If no part of your program knows anything about the interface, then
> reversing or permuting a list doesn't change the one property you do
> know about the list: its length.  Some parts of the program, i.e.,
> some functions, needn't know anything about it (the ones that
> reverse and permute, etc.) but if no part of the program knows
> anything about what's in the list, you might as well replace it with
> a non-negative integer as Ken proposed earlier; that would retain as
> much usable information about the list as keeping the list itself.

Yes.

But suppose you are writing the permute function.  While it is true
that any client of permute that knows nothing about the objects being
permuted can tell if you did anything, you can hardly ask the client
to prove that it could tell.

"Anton van Straaten" <anton@appsolutions.com> originally wrote:
> 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?

And my answer is `permute it, compute it's length, create the power set,
create a wedge product, all sorts of fun things, create a `generator', 
all sorts of fun things'.

*Presumably* someone, somewhere cares about the result, but we don't
need to involve them (and whatever they statically know about the
list), to correctly perform our operation.  As the implementor of the
permute function, I simply do not care whether the list even *has* a
static type.