caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Didier Remy <Didier.Remy@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Funny name for a type variable in the output: should this be filed on the BTS?
Date: Thu, 22 Mar 2012 15:40:26 +0100	[thread overview]
Message-ID: <4F6B39DA.7080701@inria.fr> (raw)
In-Reply-To: <4F6B2B83.3070003@gmail.com>

> Jacques Garrigue recently implemented a patch that tries to keep user-provided
> type names when printing out types, and also when giving error
> messages. In your
> example, there probably is an internal variable that's called "a" because of the
> type name you provided. Some wizardry happens with GADTs, so another type
> variable is generated. The other one ends up being printed, and because it's
> called "a" too, the type-checker has to find another suitable name.
>
> Or something like that. Maybe change type a b. to type foo bar. will give
> different results :).

This is an explanation of why it is printed so.

The question of Roberto is rather whether this is intended or should be
fixed (call it a bug or anything else).

If the intention is that types should be printed with _best_ variable names
for some meaning of best (shortest, reuse source variable names whenever
meaningful, etc.), I do not see any reasonable definition of "best" that
would imply printing 'a1 in Roberto's example instead of 'a, while 'a is
printed in the two following examples (especially the second one) while
it appears in the source---and also unified with int in the second example.

         let id : 'a -> 'b = function x -> 1
         id : 'a -> 'a

         let foo : 'b -> 'a = function x -> fst x; 1;;
         val foo : 'a * 'b -> int = <fun>

Thus, I would tend to call this a bug (a something that should be fixed if
possible)...

         Didier



  reply	other threads:[~2012-03-22 14:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-22  9:51 Roberto Di Cosmo
2012-03-22 12:05 ` Julien Signoles
2012-03-22 13:39   ` Jonathan Protzenko
2012-03-22 14:40     ` Didier Remy [this message]
2012-03-22 22:12 ` Jacques Garrigue
2012-03-22 23:35   ` Roberto Di Cosmo
2012-03-23  5:52   ` Gabriel Scherer
2012-03-23  6:45     ` Jacques Garrigue
2012-03-23  8:13       ` Roberto Di Cosmo
2012-03-23 10:25       ` Gabriel Scherer
2012-03-24  0:24         ` Jacques Garrigue

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=4F6B39DA.7080701@inria.fr \
    --to=didier.remy@inria.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;
as well as URLs for NNTP newsgroup(s).