On Thursday 03 April 2008 10:54:43 daniel.c.buenzli wrote:
> On 3 avr, 01:46, Jon Harrop <[EMAIL PROTECTED]> wrote:
> > F# has an interesting solution to this problem as well. F# does away with
> > functors and replaces Set.Make and Map.Make with univeral sets and maps
> > but these classes derive from the universal base class "obj" and override
> > the built in equality, comparison and hashing functions.
>
> You can always have better behaviour and terse syntax by requiring
> things to be built-in types (I wouldn't call this interesting), but
> this doesn't scale if you cannot do the same with your own
> datastructures, so how does it work in the latter case ? Note also
> that sometimes you also want to be able to choose a comparison
> function that differs from the one tailored to type your acting upon.

Yes. You are just overriding the default comparison method provided for all 
classes in .NET. To use a different comparison for an existing type, you just 
create a subtype and override the comparison method.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html
-~----------~----~----~----~------~----~------~--~---

Reply via email to