caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: cstork@ics.uci.edu
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Using Polymorphic Variants
Date: Mon, 03 Oct 2005 16:55:19 +0300 (EEST)	[thread overview]
Message-ID: <20051003.165519.18311666.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <20051002164508.GA1686@anthony.ics.uci.edu>

From: Christian Stork <cstork@ics.uci.edu>
> On Sun, Oct 02, 2005 at 10:43:42AM +0200, Jean-Marie Gaillourdet wrote:
> > Christian Stork schrieb:
> > > Basic Question:  
> 
> > >     Why aren't polymorphic variants coerced by default?
> 
> > I guess there is some undecidability involved.
> 
> My guess too, but I'd like to be sure. ;-)

Not really undecidable, but you would have to completely change the
way types are inferred, and accept type schemes with subtyping
constraints (cf. HM(X)).
Keeping all the subtyping explicit makes things simpler.
So there is no plan to change this.

> > >     ... f (x: type_of_x :> type_expected_by_f) ...
> > Isn't it possible to write something like that:
> >  (f: 'a) (x: type_of_x :> 'a)

The subtyping algorithm only looks at explicit types, so the sharing of
'a has no effect. In simple cases (with no recursive types), the
following will work:
  (c : type_of_x :> [> type_of_x ])

Jacques Garrigue


      reply	other threads:[~2005-10-03 13:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-02  0:06 UsingPolymorphic Variants Christian Stork
     [not found] ` <433F9DBE.6020509@gaillourdet.net>
2005-10-02 16:45   ` [Caml-list] Using Polymorphic Variants Christian Stork
2005-10-03 13:55     ` Jacques Garrigue [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=20051003.165519.18311666.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=cstork@ics.uci.edu \
    /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).