Browse thread
interest in a much simpler, but modern, Caml?
[
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: | Christophe TROESTLER <Christophe.Troestler+ocaml@u...> |
| Subject: | Re: [Caml-list] interest in a much simpler, but modern, Caml? |
On Sun, 8 Aug 2010 23:47:20 +0200, bluestorm wrote: > > >> > > Is there a better approach to polymorphic equality floating around? > >> > > >> > Besides type classes? I'm not sure. It's probably possible to remove > >> > this feature from the language, with a little bit of syntactic > >> > overhead to pass around a matching comparison function. > >> > >> Yes for instance the very concise local opening notation comes in handy > >> here: > >> > >> if Int.(x = 42) then ... else ... > > > > That's very nice. I don't think type classes are conservative enough for > > this project, but this comes very close indeed. > > I haven't really had a chance to explore OCaml 3.12 yet, as it came out > > while I was working on this, but I will give this serious consideration. > > This approach is very nice indeed, but to make it practical you have > to have one of the two following features : > - a more restricted form of "open" statement that does not blindly > import *all* the module values This is possible to do with Delimited Overloading (pa_do): http://pa-do.forge.ocamlcore.org/ > - nested modules > > The other way to solve the problem is to put the dangerous infix > operators into a submodule, eg. Infix or Ops. You have a Int module > with int-specific functions that are not likely to silently conflict > with values of other modules, and an Int.Infix module meant to be used > in that "local open" form : Int.Infix(x + 1 = 2). This is possible to "import" the overloaded functions form a submodule but has to be done by hand for the moment because there is no consensus on what the name of the submodule should be. My 0.02¤, C.