On 2003-11-18T14:11:15-0800, Steve Dekorte wrote: > Ok, now let's take a simple and common example such as a List that can > hold any collection of objects (of different types). How do we > implement such a thing in a statically typed system? For example, let's > say our List object has an "at(index)" method which returns the object > at the specified index. What would the return type for such a method > be? - without being the equivalent of a void *, in which case, we can > once again get "object does not respond to this message" errors, which > is what the static type system was supposed to prevent. Funny how existential types keep coming up. (: Konstantin Läufer. 1996. Type classes with existential types. Journal of Functional Programming 6(3): 485-517. http://www.math.luc.edu/~laufer/papers/jfp96.pdf http://www.math.luc.edu/~laufer/papers/Haskell/ http://www.math.luc.edu/~laufer/research/publications.html (By the way, if all you know about the List is that it contains a bunch of objects, and if there is nothing that you can do with every object -- that is, if there is no message that every object responds to -- then it is a pretty useless List, which you might as well replace with a nonnegative integer.) Ken -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig http://www.lp.org/
Attachment:
signature.asc
Description: Digital signature