Browse thread
Smells like duck-typing
-
Dario Teixeira
- Arnaud Spiwack
- Daniel_Bünzli
- Chris King
- Zheng Li
- Vincent Aravantinos
- Richard Jones
- Dario Teixeira
- Vincent Aravantinos
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Dario Teixeira <darioteixeira@y...> |
| Subject: | Re: [Caml-list] Smells like duck-typing |
Hi,
> So all full stories are also blurbs, but blurbs are not full stories.
> So full stories are a more specific type than blurbs are, because while
> we can always use a full story as a blurb, we can't use a blurb as a
> full story.
Nope, nothing like that. Read carefully what I wrote: I simply said
that any method that works on a blurb should also work on a full story.
I didn't say anything about reversing the IS-A relation (and yes, I know
that OCaml's inheritance has different semantics, but I am talking here
about OOP in general).
In fact, a blurb is a kind of story. Just one that has been restricted
such that some of story's fields/methods cannot be used on blurb. Now
the OOP purists will jump and say that this violates inheritance. Which
is precisely my point and why I don't call it inheritance!
> It's much easier, rather than detecting when things have to be removed,
> to simply detect when things can be added. Every "remove members"
> relationship can be expressed as an "add members" relationship going the
> other direction. Start with the simpler (fewer members) type and then
> create the derived type by adding members to make the more complex (more
> members) type. Anything you can do with one direction of deriving types
> you can do with the other direction of deriving.
That is true for most problems. However, I just described one particular
class of problem where it is more natural (and correct if you will) to
derive by deconstruction rather than by construction.
Cheers,
Dario
___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html