caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Record field disambiguation in 4.01
@ 2013-03-09 23:39 Yaron Minsky
  2013-03-10  1:24 ` Jacques Garrigue
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Yaron Minsky @ 2013-03-09 23:39 UTC (permalink / raw)
  To: caml-list

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-03-12 20:42 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-09 23:39 [Caml-list] Record field disambiguation in 4.01 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
2013-03-12 15:29       ` Jacques Carette
2013-03-12 17:07         ` Gabriel Scherer
2013-03-12 20:42           ` Jacques Garrigue

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