Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: boos@gr6.u-strasbg.fr (Christian Boos)
To: caml-list@pauillac.inria.fr
Subject: Automatic coercition to a more general type ?
Date: Wed, 19 Jun 96 13:12:36 +0200	[thread overview]
Message-ID: <9606191112.AA11535@gr6.u-strasbg.fr> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]



Bonjour,


J'ai une question concernant le sous-typage et la nécessité de faire
une coercition explicite d'un objet en un type plus général (par
exemple pour mettre des objets de classes différentes dans une même
liste, en forçant un type 'ancêtre commun', cf. exemple point et color_point 
de la doc). 

N'y aurait-t-il pas moyen de réaliser cette coercition de façon
automatique en trouvant le type intersection des types de ces objets ?

L'unification de deux types de classes différent consisterait à
trouver leur type intersection, et à ne renvoyer une erreur que si un
tel type n'existe pas. En cas de succès, le type unifié est bien
entendu ce type intersection.

Je ne sais pas si cela poserait des problèmes d'ordre théorique. 


------


Hello,

I have a question about subtyping, and the need to explicitly coerce
the type of an object to be of a more general type, when needed.
I wonder if it is possible to do this coercition automatically. When
unifying a type 'class_a' with a type 'class_b', the typechecker tries
to find a new type 'class_c' which is the intersection of 'class_a'
and 'class_b'. If this is successfull, then the resulting type would
be 'class_c', if not, the unification would fail.

Perhaps there's theoretical weakness to this proposal ?



-- Christian






             reply	other threads:[~1996-06-19 12:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-19 11:12 Christian Boos [this message]
1996-06-20 16:42 ` Didier Remy

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=9606191112.AA11535@gr6.u-strasbg.fr \
    --to=boos@gr6.u-strasbg.fr \
    --cc=caml-list@pauillac.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