[
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: | Seth J. Fogarty <sfogarty@g...> |
| Subject: | Re: [Caml-list] Polymorphic Variants |
I find them prinicipally useful in three situations: 1) When I am writing code for an easy subset of a problem, and wish to extend it later. This is the least useful case, easiest to replace. 2) When I have different overlapping kinds of data, with a common root and common parent, and functions that are only defined on certain branches of the 'type tree.' This would be the hardest to replicate. 3) When I have intermediate labelled data for gathering different subproblems together. This is the neatest use: I extend my algorithm to handle a case that might return the top two, and I just add an additional case to the destructor for `TopTwo instead of `Best or `SecondBest. On 1/16/07, Tom <tom.primozic@gmail.com> wrote: > I have a question... I hope it will not be dismissed right away, thou I > guess most of you will find it stupid (some might however agree with me... > hopefully). > > Cut the crap! > > So... why actually are polymorphic variants useful? Why can't they simply be > implemented as normal, concrete (or how would you call them? ...) variants? > Doesn't the use of polymorphic variants just mess up the function type? > > I'm not orthogonally against polymorphic variants, it's just that I am > looking for an alternative concept that could be used instead... Maybe > subtyped records? > > - Tom > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: > http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > > -- Seth Fogarty sfogarty@[gmail.com|rice.edu|livejournal] Neep-neep at large AIM: Sorrath "Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred." - Martin Luther King, Jr.