[Caml-list] zero-arity constructor

2010-11-26 Thread Julia Lawall
The following code compiles in 3.12.0 but doesn't compile in 3.10.2. Is it a bug or a feature? type ty = A | B let start x = match x with A _ -> () | _ -> () julia ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi

Re: [Caml-list] zero-arity constructor

2010-11-26 Thread Mehdi Dogguy
On 11/26/2010 10:46 PM, Julia Lawall wrote: > The following code compiles in 3.12.0 but doesn't compile in 3.10.2. > Is it a bug or a feature? > It's a feature that was implemented in 3.11.0 (iirc). See: http://caml.inria.fr/mantis/view.php?id=4675 (and other related bugreports). Regards, --

Re: [Caml-list] zero-arity constructor

2010-11-26 Thread Julia Lawall
On Fri, 26 Nov 2010, Mehdi Dogguy wrote: > On 11/26/2010 10:46 PM, Julia Lawall wrote: > > The following code compiles in 3.12.0 but doesn't compile in 3.10.2. > > Is it a bug or a feature? > > > > It's a feature that was implemented in 3.11.0 (iirc). > > See: http://caml.inria.fr/mantis/view.

Re: [Caml-list] zero-arity constructor

2010-11-26 Thread bluestorm
A quick summary for those like me that didn't follow the change and were baffled to find out that "it's not a bug, it's a feature". The change was asked for by Alain Frisch in 2006 ( http://caml.inria.fr/mantis/view.php?id=4052 ) and finally added in ocaml 3.11. The rationale is to make it easy to

Re: [Caml-list] zero-arity constructor

2010-11-27 Thread mark
Surely it's preferable to use a syntactically distinct mechanism for this subtly different concept. Given that we're talking about patterns and not general expressions here, surely there's plenty of space in the syntax. Perhaps something like '*' to mean 0 or more. Or is it already too late becau

RE: [Caml-list] zero-arity constructor

2010-11-27 Thread David Allsopp
Mark Adams wrote: > Surely it's preferable to use a syntactically distinct mechanism for this > subtly different concept. Given that we're talking about patterns and not > general expressions here, surely there's plenty of space in the syntax. > Perhaps something like '*' to mean 0 or more. Even

Re: [Caml-list] zero-arity constructor

2010-11-27 Thread bluestorm
On Sat, Nov 27, 2010 at 10:49 AM, wrote: > Surely it's preferable to use a syntactically distinct mechanism for this > subtly different concept. Agreed. > Perhaps something like '*' to mean 0 or more. Or is it already too late > because '_' has already been incorporated and backwards compati

Re: [Caml-list] zero-arity constructor

2010-11-27 Thread Julia Lawall
In my case, I originally thought that the constructor should take an argument, then changed my mind. I would have hoped that OCaml would have found the inconsistency. That's what static typing is for. Thus, I find the change quite disappointing. Perhaps it would have been nicer to have an op

Re: [Caml-list] zero-arity constructor

2010-11-27 Thread bluestorm
A quick follow-up on my post, about a discontinuity in the current syntax. It is possible to write a pattern to ignore the two parameters of a constructor, but fail if the constructor has a different number of parameter : Foo (_, _). To my knowledge, it is not possible to ignore one parameter, but

Re: [Caml-list] zero-arity constructor

2010-11-27 Thread Martin Jambon
On 11/27/10 04:23, Julia Lawall wrote: > In my case, I originally thought that the constructor should take an > argument, then changed my mind. I would have hoped that OCaml would have > found the inconsistency. That's what static typing is for. Thus, I > find the change quite disappointing.

Re: [Caml-list] zero-arity constructor

2010-11-28 Thread Alain Frisch
On 11/27/2010 11:31 AM, bluestorm wrote: Reversing the specific 0-ary modification suggested by Alain is probably easier, as I suspect most users don't use that one much, but Alain probably makes use of it; As I've been designated as the primary responsible for that uninspired change (I plead

Re: [Caml-list] zero-arity constructor

2010-12-01 Thread Damien Doligez
On 2010-11-28, at 12:13, Alain Frisch wrote: > As I've been designated as the primary responsible for that uninspired change > (I plead guilty), I guess it is my responsibility to state here that frankly, > I don't give a damn. That said, enabling the warning by default sounds better > to me t

Re: [Caml-list] zero-arity constructor

2010-12-01 Thread Damien Doligez
On 2010-11-27, at 11:21, David Allsopp wrote: > and set Warning 28 to be on by default for [Foo _] - that would simply mean > that 3.11/3.12 code using that syntax would emit warnings in "3.13" rather > than actually breaking (unless you've including -warn-error - but that's > always seemed to