I agree that making recursitivy more explicit is... well... more explicit :) But I wonder if, in this case, this is truly relevant. In fact, when I look at OCaml programs, I see many recursive types and very few type shadowing. That is, making types non recursive would add some "rec" or "nonrec" keywords everywhere just to avoid a type alias in a rare case. From readability point of view, I'm not sure it's a good deal. In the programs I know, the ratio seems to be something like 70/30 for nonrec/rec function while, this time, shadowing is quite often used. Here, explicit "rec" allows us to avoid more "nonrec" elsewhere to continue using shadowing.



2013/5/20 David House <dhouse@janestreet.com>
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