caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
To: Pierre Weis <pierre.weis@inria.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] Understanding why Ocaml doesn't support operator overloading.
Date: Sun, 01 Dec 2002 07:40:04 +0000	[thread overview]
Message-ID: <3DE9BCD4.8040503@univ-savoie.fr> (raw)
In-Reply-To: <200211302147.WAA29551@pauillac.inria.fr>

Pierre Weis wrote:

 >
 > Yes: I suspect a really nasty corner in this area. As far as I
 > remember, the kind of types you suggest is known as ``intersection
 > types'', and the type reconstruction problem for languages featuring
 > those types is just undecidable. The big problem with this kind of
 > stuff is to restrict the type schemes allowed in your type system such
 > that you do not fall into the undecidable general case, while still
 > maintaining a powerful enough type system to properly typecheck the
 > function double (fun x -> x + x).
 >

This is not the only solution: another solution is to keep the simple (in the
definition) type system with an incomplete algorithm that will always succeed
if enough type information. This works for instance for Mitchell's system F
with subtyping (see my normaliser:
<http://lama-d134.univ-savoie.fr/~raffalli/normaliser.html>)

The diffculty is that you need to have a very good way of printing typing error
message so that the user can easily guess where to add type information until
it works or a real error in the code is detected. Recent work (in a simple
setting) by Christian Haack, and Joe Wells
<http://www.cee.hw.ac.uk/ultra/compositional-analysis/type-error-slicing> let
me think that there may be a (non trivial) solution.

The big advantage, is that there are (undecidable) type systems that can
unifies typing of record, modules and object; functor and functions. Then, you
have a simpler type system definition which is easier to extend (with operator
overloading, for instance).

Remark: it does not change much the picture, because you have to find a
subsystem of the simple undecidable system. The difference, is that you can
define the subsystem by some limit to the typing complexity in the undecidable
system ... This is still far from trivial, but there is a lot of freedom (so
place for research :-).

-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-12-02 20:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-28 21:02 Jørgen Hermanrud Fjeld
2002-11-28 21:27 ` Jørgen Hermanrud Fjeld
2002-11-29 15:26 ` Xavier Leroy
2002-11-29 15:42   ` Christophe Raffalli
2002-11-29 16:52   ` Nicolas Cannasse
2002-11-29 17:26     ` Michal Moskal
2002-11-30  0:00       ` Mike Lin
2002-11-30 10:24         ` Michal Moskal
2002-11-30 23:06           ` Mike Lin
2002-11-30 21:41         ` William Lovas
2002-12-01 17:30           ` Pierre Weis
2002-12-01 23:41             ` William Lovas
2002-12-02  9:52               ` Remi VANICAT
2002-11-30 21:47         ` Pierre Weis
2002-12-01  7:40           ` Christophe Raffalli [this message]
2002-11-30 21:36       ` Pierre Weis
2002-11-30 21:33     ` Pierre Weis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DE9BCD4.8040503@univ-savoie.fr \
    --to=christophe.raffalli@univ-savoie.fr \
    --cc=caml-list@inria.fr \
    --cc=pierre.weis@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).