On Tuesday 06 October 2009 13:19:58 Philippe Wang wrote: > Hello, > > I don't know the actual reason, but I guess it's simply a choice of > semantics. > > It woud be weird to be able to deconstruct (Bar 42) while not be able > to deconstruct (Bar) as it's not constructed. > I mean we can write (match x with Bar y -> y). > If partial construction were accepted we may like to write > (match x with Bar -> x) but we couldn't because Bar is like a function > then. > > With type t = A | B of int > what would be the error warning for > (match x with A -> 42 | B -> 43) ? > > Well, then I guess the reason is that it would be complicated to > choose some sound enough semantics for partial application of > constructors, since the solution of having to write (fun x -> Bar x) > is much simpler.
Can you not just say that Bar in an expression is a function (fun x -> Bar x)? -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
