From: Yaron Minsky <yminsky@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Record field disambiguation in 4.01
Date: Sat, 9 Mar 2013 18:39:56 -0500 [thread overview]
Message-ID: <CADKNfhKDC-EwsKkjZ+uqbary5Cy48k=+J_GX4dzAMCi5v0hsNg@mail.gmail.com> (raw)
This is all in the vein of complaining about a feature that has not
yet been released, so, apologies if all of this is already known and
plans are there for fixing it.
I've been playing around with a recent 4.01 snapshot of the compiler
in OPAM, and have run against an interesting issue with the record
field disambiguation. In particular, I have some code that looks
roughly like this:
open Core.Std
type posn = { x: float; y: float }
let cross_product p1 p2 =
p1.x *. p2.y -. p1.y *. p2.x
;;
And when I try to compile this, I get the following error:
File "geometry.ml", line 68, characters 13-14:
Warning 41: this use of y is ambiguous.
File "geometry.ml", line 1:
Error: Error-enabled warnings (1 occurrences)
Command exited with code 2.
This can be fixed by adding an annotation:
let cross_product p1 (p2:posn) =
p1.x *. p2.y -. p1.y *. p2.x
;;
A few concerns: one, it's really hard to figure out where the source
of the conflict is from this message. It would be nice to get some
clue from the compiler as to the two definitions that are conflicting.
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.
y
next reply other threads:[~2013-03-09 23:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-09 23:39 Yaron Minsky [this message]
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
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='CADKNfhKDC-EwsKkjZ+uqbary5Cy48k=+J_GX4dzAMCi5v0hsNg@mail.gmail.com' \
--to=yminsky@gmail.com \
--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