|
![](/i/fill.gif) |
Invisible <voi### [at] dev null> wrote:
[tldr]
> and this is valid. Notice, however, that it is impossible to write an
> "unwrap" function. Because once you "wrap" something, its original type
> information is lost forever, so there's no way in hell to know what type
> to cast it back to.
what about in heaven? In Lisp there's no such hellish troubles. :)
> Now a "shape" is simply an ordinary data structure, which contains some
> function pointers. And each sort of shape - a sphere, a cone, whatever -
> is an ordinary /function/ which fills out this data structure with the
> right function pointers. In particular, every type of shape now has the
> same type signature. There is no Sphere type, no Plane type, no Cone
> type, there is only a Shape type. So now we can write
>
> [sphere 0 1, plane 1 0]
>
> and have it be well-typed. (It's [Shape].)
So your solution to get away from the complaints of the compiler is to have all
types be the same single type? Yes, sounds like the Lisp solution too. ;)
> The short summary is that Haskell, the finest
> functional programming language in the land, is superior to Java, one of
> the more sucky OOP languages. Not exactly a revelation, is it? I think
> I'm going to go outside for a while...
you do good. :)
Post a reply to this message
|
![](/i/fill.gif) |