caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Yaron Minsky <yminsky@janestreet.com>
Cc: Mailing OCaML <caml-list@inria.fr>
Subject: Re: [Caml-list] Record field disambiguation in 4.01
Date: Wed, 13 Mar 2013 00:05:46 +0900	[thread overview]
Message-ID: <F9778E18-9EE1-420E-A9CF-23BB80A7DCF4@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <CACLX4jSxsa1DAZPCVRs7D+B9Bhjt=OUCDgSScE3oQRanV0sdZw@mail.gmail.com>

On 2013/03/12, at 3:52, Yaron Minsky <yminsky@janestreet.com> wrote:
> On Mon, Mar 11, 2013 at 7:52 AM, Alain Frisch <alain@frisch.fr> wrote:
>> The warning tells you something useful: with that record type declaration,
>> the reference to field "y" becomes ambiguous, which means in particular that
>> (i) your code might become fragile w.r.t. reordering of type declarations,
>> (ii) the code might become harder to read (the reader might expect that
>> field "y" is typically related to a different record type in your code
>> base).  Of course, a more explicit warning message, as you suggest, would be
>> even better.

I have improved the warning (revision 13395), so that it tells you the types involved.
This should actually help in some hairy situations.

>> During the discussion on type-based disambiguation, Mark Shinwell commented
>> that most record types in JS code base are defined in nested modules (and
>> often exposed only through builder functions) to avoid label clashes.  Is
>> your example an instance where this is not the case?
> 
> It is.  If I'd turned the warning off, would it have in fact picked
> the more recent definition?

Yes, the new strategy is fully backward-compatible.
It just accepts more programs, and there are many new warnings so
that you can tune it to your taste. Using all of them is probably self-defeating,
as for instance warning 42 warns you when something has been accepted
that was not accepted before.

	Jacques

  parent reply	other threads:[~2013-03-12 15:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-09 23:39 Yaron Minsky
2013-03-10  1:24 ` Jacques Garrigue
2013-03-11 11:38   ` Maxence Guesdon
2013-03-12  7:57     ` Alain Frisch
2013-03-10  3:04 ` Markus Mottl
2013-03-10  9:33   ` Gabriel Scherer
2013-03-11 10:31     ` Goswin von Brederlow
2013-03-12 11:30       ` Leo White
2013-03-11 18:49   ` Yaron Minsky
2013-03-11 11:52 ` Alain Frisch
2013-03-11 18:52   ` Yaron Minsky
2013-03-12  8:05     ` Alain Frisch
2013-03-12 15:05     ` Jacques Garrigue [this message]
2013-03-12 15:29       ` Jacques Carette
2013-03-12 17:07         ` Gabriel Scherer
2013-03-12 20:42           ` 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=F9778E18-9EE1-420E-A9CF-23BB80A7DCF4@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=yminsky@janestreet.com \
    /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).