Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Pierre Weis <Pierre.Weis@inria.fr>
To: bonnardv@pratique.fr (Valentin Bonnard)
Cc: caml-list@inria.fr
Subject: Re: Operateurs < et =
Date: Mon, 3 Feb 1997 09:38:09 +0100 (MET)	[thread overview]
Message-ID: <199702030838.JAA11032@pauillac.inria.fr> (raw)
In-Reply-To: <v01530503af194db30743@[194.98.4.80]> from Valentin Bonnard at "Feb 1, 97 08:03:31 pm"

> Pourquoi n'est il pas possible de definir l'egalite et l'ordre
> sur un type en Caml ? Bien sur je peut definir des fonctions
> est_egal et inferieur_a mais comme les fonctions du module eq
> sont polymorphes je voudrait definir ces fonctions sur mes
> types (exemple: le type fraction).

Ceci est une autre histoire, en ce sens que c'est tre`s difficile a`
imple'menter et a` typer. Si vous savez le faire dites le nous.

> De plus la notion d'ordre physique pourrait etre 
> interressante; de meme qu'il y a deux comparaisons, une 
> correcte et une rapide = et ==, il pourrait y avoir deux
> ordre, un correct (2/4 < 1/1) et un artificiel (un ordre
> quelconque defini y compris sur les fonctions).
> 
> Cet ordre rapide pourrai etre la comparaison des addesses,
> la comparaison des representations (memcmpr) ou quelque 
> chose comme ca.

Le proble`me est que la comparaison des adresses fait l'hypothe`se que
les objets ne se de'placent pas dans la me'moire, ce qui n'a aucune
raison d'e^tre vrai dans toutes les imple'mentations, et qui est faux
en particulier en Caml Light et O'Caml.

> Abstract: why isn't it possible to define the equalty and 
> order over a user defined type ? (2,4 < 1,1 but 2/4 < 1/1)

Because we don't know how to implement it. Design a type system and a
compiler for that, then publish an article in POPL.

> Also like there are = and ==, why isn't there a fast
> physical comparison defined for all types (even functions) ?

As above, we don't know how to implement it, particularly when objects
may move (due to the memory manager, and the fast generational garbage
collector as in Caml Light and O'Caml).

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis







      reply	other threads:[~1997-02-03  8:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-01 19:03 Valentin Bonnard
1997-02-03  8:38 ` Pierre Weis [this message]

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=199702030838.JAA11032@pauillac.inria.fr \
    --to=pierre.weis@inria.fr \
    --cc=bonnardv@pratique.fr \
    --cc=caml-list@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