caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yaron Minsky <yminsky@janestreet.com>
To: Alain Frisch <alain@frisch.fr>
Cc: yminsky@gmail.com, caml-list@inria.fr
Subject: Re: [Caml-list] Record field disambiguation in 4.01
Date: Mon, 11 Mar 2013 14:52:24 -0400	[thread overview]
Message-ID: <CACLX4jSxsa1DAZPCVRs7D+B9Bhjt=OUCDgSScE3oQRanV0sdZw@mail.gmail.com> (raw)
In-Reply-To: <513DC595.9020006@frisch.fr>

On Mon, Mar 11, 2013 at 7:52 AM, Alain Frisch <alain@frisch.fr> wrote:
> On 03/10/2013 12:39 AM, Yaron Minsky wrote:
>>
>> Also, I'm wondering if anyone has thoughts as to how much code this
>> change will break?  The answer might be "quite a lot", and it might
>> nonetheless be worth it.  But I'm curious what people's thoughts are.
>
>
> As Jacques said, this is only a warning, which is turned off by default.  I
> expect that all the "unused stuff" warnings also broke most code bases
> around which are compiled with "-w +A -warn-error A".  I'm sure you are not
> suggesting that new warnings should never be triggered on code which used to
> be well-typed by a previous version of the compiler...

That is entirely sensible.  I normally run with all warnings on, minus
a handful of explicit ones I don't want.  That normally works well
(since most new errors are in fact helpful!)

> 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.

Agreed.

> 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?

y

>
> Alain
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

  reply	other threads:[~2013-03-11 18:52 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 [this message]
2013-03-12  8:05     ` Alain Frisch
2013-03-12 15:05     ` Jacques Garrigue
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='CACLX4jSxsa1DAZPCVRs7D+B9Bhjt=OUCDgSScE3oQRanV0sdZw@mail.gmail.com' \
    --to=yminsky@janestreet.com \
    --cc=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    --cc=yminsky@gmail.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).