|Anonymous | Login | Signup for a new account||2015-03-28 05:01 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002353||OCaml||OCaml general||public||2004-03-17 11:05||2013-08-31 12:46|
|Target Version||Fixed in Version|
|Summary||0002353: Curried data constructors (feature wish)|
|Description||Full_Name: Fermin Reig|
Submission from: franc.cs.nott.ac.uk (126.96.36.199)
I would like to have curried data constructors, a la Haskell. Xavier Leroy has
already stated (http://caml.inria.fr/archives/200108/msg00022.html [^]) that this
will not be made the default behaviour in Caml. What I would like to have is the
*option* of having curried constructors. This would be a backwards-compatible
extension, which would have no impact on programs that don't use it.
A possible syntax is:
type t = Curried of int int | ...
The underlying representation of this in terms of the current syntax would be:
Curried of int, int
That is, the arity is 2 in both cases. Each ocurrence of 'Curried' in an
expression can be desugared to (fun x y -> Curried x, y). A similar translation
is done in patterns. I believe this needs be done before type-checking. In
addition, for exported types, the fact that a constructor is curried should be
present in .cmi files, so that desugaring is done in client modules.
|Tags||No tags attached.|
Camlp4 and the revised syntax provide some amount of support for curried constructors. We do not think it would make a good addition to the traditional syntax.
|2005-11-18 10:13||administrator||New Issue|
|2012-01-30 15:25||doligez||Note Added: 0006841|
|2012-01-30 15:25||doligez||Status||acknowledged => resolved|
|2012-01-30 15:25||doligez||Resolution||open => won't fix|
|2012-01-30 15:25||doligez||Description Updated||View Revisions|
|2013-08-31 12:46||xleroy||Status||resolved => closed|
|Copyright © 2000 - 2011 MantisBT Group|