Am Donnerstag, den 12.11.2015, 19:39 +0100 schrieb Virgile Prevosto: > 2015-11-12 18:26 GMT+01:00 Daniel Bünzli : > > Le jeudi, 12 novembre 2015 à 16:37, Leo White a écrit : > >> > This misses the point. By using `with` I can instruct the compiler that I don't want my program not to compile if I add or remove fields. In the current system I can do this with any update I want to make to a record except if for some strange reason that update happen to touch all the current fields of the record. > >> > >> I don't particularly wish to argue for or against using this warning, but I think it is worth noting > >> that this is not really any different from: > > > > […] > > > > It's quite different: you have dead code in your example. > > > > But in the record case, the expr in { expr with ... } will indeed be > evaluated (thus is not dead), but its result will never be used, which > is barely better. In the (admittedly contrived) example below, > investigating the cause of the warning would save you from a runtime > exception: > > type foo = { a : int; } > let rec x = lazy { a = (Lazy.force x).a } > let y = { (Lazy.force x) with a = 42 } > > Now that I think of it, it is more like warning 26, with the exception > that in the present case, the expression is usually a variable and > thus already evaluated. Maybe print the warning only in the non-variable case? And rephrase the warning to "the expression before 'with' is not evaluated"? Gerd > > Best regards, > -- > E tutto per oggi, a la prossima volta > Virgile > -- ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------