[
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: | John Max Skaller <skaller@o...> |
| Subject: | Re: [Caml-list] ocaml and named constants |
Luc Maranget wrote: > But I have another remark as far a ``manifest constants'' are the issue, Polymorphic > variants seem to do the job. > > After all, provided you do not care much about the actual value of Foo) > you can write : > > match x with > | `Foo -> ... > | `Bar -> ... > | _ -> ... In the 'real world' the constants are often integers or strings whose values are dictated by standards, and this technique requires providing two functions to map the value to and from variants. Sometimes this is OK. Sometimes, it is a problem: for example the library Posix support is lacking all the error codes and socket options available on some platforms, and there is no workaround (other than magic). -- John (Max) Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr