Browse thread
[OSR] Suggested topic - XML processing API
[
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: | tab@s... |
| Subject: | Re: [Caml-list] [OSR] Suggested topic - XML processing API |
On Tue, Feb 05, 2008 at 11:31:22AM +0100, Bünzli Daniel wrote: >> that's really a bad idea; As a user of xmlm, I hope you're going to >> re-consider. the polymorphic variant namespace is so easily polluted by >> random "value" > > What people seem to fail to understand is that with polymorphic variants if > you close them and write mlis you get exactly the same typechecking as with > regular variants but without being tied to a particular module. For example > if define you might have the same typechecking, but consider my example in the other thread. If I type `ISO_8850_1 somewhere by mistake, the error reporting is going to be extremely crappy. > type encoding = [ `ISO_8859_1 | `US_ASCII | `UTF_16 | `UTF_16BE | `UTF_16LE > | `UTF_8 ] > and then ask for this type exactly in a function type, e.g. > val encoding_to_string : encoding -> string > then you get exactly the same typechecking as with a regular variants on > applications of encoding_to_string. > Using variants allows you to have a better decoupling between say your own > modules that hande encodings and xmlm. As Jacques mentions this actually > may prevents pollution from xmlm to your own modules. That's true you could do that if you want to provide interface, but you got functor to achieve the same result, without using polymorphic variant and without polluting your own modules, with still the same strong type thing that people using ocaml are used to. -- Vincent Hanquez