English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
interest in a much simpler, but modern, Caml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-08-08 (19:39)
From: Jeremy Bem <jeremy1@g...>
Subject: Re: [Caml-list] interest in a much simpler, but modern, Caml?
On Sun, Aug 8, 2010 at 2:52 PM, Florian Weimer <fw@deneb.enyo.de> wrote:

> * Jeremy Bem:
> > Yes and no, respectively.  In other words, nothing new here.
> Oh.  I just happen to think that those two are very high on the list
> of things you want to fix once you can start with a clean slate.
> > 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.

Maybe I should clarify that my main goal has been to bring Caml Light
up-to-date with OCaml's improvements, while keeping the type-checking code
very simple, not to try to make further improvements.  In fact, I wouldn't
necessarily claim that omitting the module and object systems is an
improvement, just that it is a simplification.

But actually, now that you mention it, I did briefly explore the idea of
removing Caml's polymorphic comparison functions.

One issue I ran into was syntactic.  How would you write:
  if 'A' <= c && c <= 'Z' then ...
where c is a char, without polymorphic comparison, and without more radical
changes such as type classes?  Ideally the solution would generalize to
int64s, etc.

I briefly had lexer support for a syntax along the lines of
  if 'A' <=`c` c && c <=`c` 'Z' then ...
In general, the backquote is available since I don't support variants.
 However, this syntax didn't feel elegant enough to warrant expanding the
Llama project's more conservative scope.  Currently OCaml can compile Llama
code, a feature which doesn't seem like it should be discarded too lightly.

I also found multiple instances of a pattern like
  type foo = Foo of int | Goo of string
  if myfoo = Foo 3 then ...
It felt tedious and perhaps destructive to re-code all of these.

Finally, on what theoretical basis do we disallow polymorphic comparison but
retain polymorphic hashing and marshalling? Perhaps we just want all these
functions to be less convenient, e.g. isolated in their own "Polymorphic"
module.  After all, Llama retains even the "Obj" module.

Once the current system is posted, I could consider making these changes
after all.  Suggestions to smooth the syntax are more than welcome.  Perhaps
a bit more time to re-code things carefully is all that is really needed.

If there is a broad consensus for immutable strings, I could make that
change as well, again with a bit of delay as I'll need to port things like
the relocation mechanism in the Llama linker, in order to remain