At Jane Street we have a syntax extension that allows one to write
"type nonrec t = ...".
I too think that non-recursive is the right default. My argument is
mostly as follows: it's nice to have nonrecursive values be the
default, because shadowing is so useful. And it's confusing to have
two different defaults for types and values.
I also agree that we can't change this for ocaml.
On 20 May 2013 15:31, Dario Teixeira <darioteixeira@yahoo.com> wrote:
> Hi,
>
>
> As you know, there is in OCaml some asymmetry regarding the rec/nonrec
> defaults for type and value declarations. Types are recursive by default
> and there's no way to "unrecurse" them, whereas values are by default not
> recursive and can be made recursive via the "rec" keyword.
>
> The unrecursiveness of type declarations is cause for some chagrin, as a
> recent ticket on Mantis demonstrates [1].
>
> Here's something I wonder: if one were to wipe the slate clean, is there
> consensus among the community about the best defaults? I'm leaning towards
> having nonrec as the default behaviour for *both* types and values, and
> using "rec" as the keyword for recursive types and values. This scheme
> would obviate the need for an actual "nonrec" keyword.
>
> Obviously, such a change would be too intrusive to make to OCaml. However,
> since people are working on "Next Generation ML" languages like Mezzo [2],
> I think it would be good to get the community's pulse on this subject.
> (Btw, from the examples posted on Mezzo's homepage, it seems to use the
> same defaults as OCaml).
>
> Your thoughts?
>
> Best regards,
> Dario Teixeira
>
> [1] http://caml.inria.fr/mantis/view.php?id=6016
> [2] http://gallium.inria.fr/~protzenk/mezzo-lang/
>
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
--
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs