On Mon, Jan 07, 2008 at 03:26:04AM -0600, Gabriel Sechan wrote:
You can't get rid of types, they're inherent in the universe- all data has a type. All you can do is not tell me wht it is.
What about a function to manipulate a list? The code implementing the list does't care what specifically the type of the list is, just that the list entirely has objects of the same type. This is the problem that type polymorphism, or generics solve. (Templates try to solve it, but don't.) A particular instance may be a List<String> or Dictionary<String,Int>, but the code for List will just refer to a generic type, say List<T>. It can even make constraints on what 'T' can be so that it can actually use it in a type-safe way. I would say it is useful to be as unspecific about a type as possible. Most languages lose type safety if you do this much, but it isn't a requirement. These are important issues to consider, though. What the programmer considers valuable information is what she or he will focus on. A programmer focusing on type produces very different code than one focusing on say logic, or flow, or structure. Dave -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
