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

Re: dynamic vs. static typing



On 2003-11-20T17:06:56-0500, Joe Marshall wrote:
> Ken Shan <ken@digitas.harvard.edu> writes:
> > etc., but in the end if you can't assume anything about the elements,
> > then you might as well not keep the elements around at all.
> 
> This is true, and you could discard the objects and manipulate an
> abstraction of them, but the client shouldn't have to do this part of
> the work.  Consider computing the cardinality of a set that is
> represented as a list of items.  The client shouldn't be required to
> convert this to a list of NILs just to ask the list library what
> the length of the list is.

I have never said that the client of a list length function needs to
convert the list to a list of NILs.  To the contrary, you can easily
call the same list length function on all sorts of homogeneous or
heterogeneous lists in say Haskell.

> It seems equally absurd to parameterize
> the list length function over the kind of elements in the list.

> Another idea, for example, is a function that permutes a list of
> elements.  The permute function doesn't need to know what the list
> holds.  Sure you can parameterize the permute function on the type of
> list, but isn't this passing inessential information?  Permute
> certainly doesn't care.

I don't know what you mean by "parameterize".  Could you please
elaborate?

> > The wedge product (or for that matter if I understand correctly, the
> > function that takes a list of values and computes their product) doesn't
> > require knowing the object types, but it does require knowing that the
> > object types are "the same" in that it requires knowing a multiplication
> > function that takes two elements and produces a new one.
> 
> The wedge product doesn't need to know about the multiplication, it is the
> `Hodge *' operator that does.

The wedge product needs to know that the objects in the matrix can be
multiplied.  The easiest way to provide the wedge product with such a
guarantee is to provide it with a multiplication function.  The wedge
product doesn't need to know about the objects in the matrix other than
that they are accepted by the multiplication function.  (There are other
ways.)

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
http://www.thismodernworld.com/
"Sendmail may be safely run set-userid to root." -Sendmail Install Guide

Attachment: signature.asc
Description: Digital signature