caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Julien Signoles <Julien.Signoles@cea.fr>
To: caml list <caml-list@inria.fr>
Subject: [Fwd: Re: [Caml-list] Re: Improving OCaml's choice of type to display]
Date: Mon, 12 Oct 2009 10:58:19 +0200	[thread overview]
Message-ID: <4AD2EFAB.9000807@cea.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 29 bytes --]

Sorry, forgot the caml-list.

[-- Attachment #2: Re: [Caml-list] Re: Improving OCaml's choice of type to display.eml --]
[-- Type: message/rfc822, Size: 2104 bytes --]

From: Julien Signoles <Julien.Signoles@cea.fr>
To: Jun Furuse <jun.furuse@gmail.com>
Subject: Re: [Caml-list] Re: Improving OCaml's choice of type to display
Date: Mon, 12 Oct 2009 10:57:34 +0200
Message-ID: <4AD2EF7E.2080105@cea.fr>

Jun Furuse a écrit :
> I have not tested it well but it counts dots and should try to find
> the minimal one.
> 
> A problem I have found so far is that it prints something confusing, ex.
> 
> module M = struct type t end
> module N = struct type t end
> open M
> open N
> 
> let _ = ( 1 : M.t )
> 
>>> Error: This expression has type int but an expression was expected of type t    (which t ?!?!?)

 From the typing environment, it refers to N.t. Hence the type error 
message is not correct.

> If there are types M.t and N.t and the both of M and N are opened,
> these types are printed just "t". This can be avoided by testing the
> result name "t" against the current typing envrionment to see it
> really means the original type "M.t". This requires more coding but
> the weekend has ended in the far east already :-)   (It's 0:24 Monday
> now.)

One solution could be the following.

Let M.t the unique long type name to simplify and let P the longest 
prefix of M removed with the "do not print opened modules" rule.
After simplifying the long name M.t to (M - P).t (that is what your 
implementation does, if I well understood), add the shortest suffix S of 
M.t such that (M - P).S.t is visible in the current typing environment.

Don't know how hard is to implement such a solution in the caml compiler.

--
Julien


             reply	other threads:[~2009-10-12  8:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-12  8:58 Julien Signoles [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-10-12  8:58 Julien Signoles

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=4AD2EFAB.9000807@cea.fr \
    --to=julien.signoles@cea.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).