|
Re: imperative, and functional, and oo, ...
|
Posted: Jul 11, 2007 12:11 PM
|
|
> > The difference with this, though, is that the base > > language just looks like a dynamically typed language. > It > > should be complete in the sense that you can imagine it > > executing and see the complete algorithm. The > annotations > > in another file would really act as constraints which > > disallow certain conditions at compile or load time. > They > > would not add functionality. > > I guess when I look at your example, I have to question > that. For example, you specify that successors and words > are hash-based dictionaries. A hash-based dictionary can > have subtle differences in behavior from a sorted > dictionary especially depending on the types being placed > in it. In general, any polymorphic language will allow a > given operation to behave in different ways. So > specifying the type could change the code especially since > there would be nothing to prevent the developer from > exploiting polymorphism in this way.
Yes, there are two different aspects in that code. If you specify the type for a created object, all of the options are open. You can do anything (it's like generics in that respect). But, if you add a type to a reference, you're constraining the type of objects that can be referred to by it. Not very easy to add functionality that way.
|
|