caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Julien Blond <julien.blond@gmail.com>
To: David House <dhouse@janestreet.com>
Cc: Dario Teixeira <darioteixeira@yahoo.com>,
	OCaml mailing-list <caml-list@inria.fr>
Subject: Re: [Caml-list] The rec/nonrec debate
Date: Mon, 20 May 2013 17:18:14 +0200	[thread overview]
Message-ID: <CAG3nF7WRqkwaSV-LObT_QEiFoXCJU_N3KCFF7=iJS9YVyL2s_g@mail.gmail.com> (raw)
In-Reply-To: <CAK=fH+iLCr=nShGNP=cjYo356RyaWnkXMMZKLS2LwZiCi9ogzg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2998 bytes --]

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
>

[-- Attachment #2: Type: text/html, Size: 4403 bytes --]

  reply	other threads:[~2013-05-20 15:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20 14:31 Dario Teixeira
2013-05-20 14:38 ` David House
2013-05-20 15:18   ` Julien Blond [this message]
2013-05-20 15:19     ` David House
2013-05-20 16:18     ` Dario Teixeira
2013-05-21 14:22       ` Richard W.M. Jones
2013-05-21 15:14         ` Dario Teixeira
2013-05-20 15:17 ` Török Edwin
2013-05-20 16:05   ` Dario Teixeira
2013-05-21  4:07 ` [Caml-list] " Hongbo Zhang
2013-05-21  8:25 ` [Caml-list] " Alain Frisch
2013-05-21 11:15   ` Boris Yakobowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG3nF7WRqkwaSV-LObT_QEiFoXCJU_N3KCFF7=iJS9YVyL2s_g@mail.gmail.com' \
    --to=julien.blond@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=darioteixeira@yahoo.com \
    --cc=dhouse@janestreet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).