From: "Török Edwin" <edwin+ml-ocaml@etorok.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] The rec/nonrec debate
Date: Mon, 20 May 2013 18:17:54 +0300 [thread overview]
Message-ID: <519A3EA2.9080804@etorok.net> (raw)
In-Reply-To: <1369060290.43256.YahooMailNeo@web120405.mail.ne1.yahoo.com>
On 05/20/2013 05:31 PM, Dario Teixeira wrote:
> 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?
Functions should definitely be non-recursive by default (like in OCaml), to at
least explicitly make you think about the termination/stack usage consequences.
For types I'd prefer non-recursive by default, but only for consistency reasons.
For 'rec' on functions it'd be nice if there was a way to require
tail-recursivity, and have the compiler reject the code if its not actually
tail-recursive or calls non-tail-recursive functions.
But what should be the default? If we apply the same reasoning as for 'rec'
(require explicity action for possibly unsafe structure), then
tail-recursive-required should be default, and you'd need a 'nontail' keyword.
That may be somewhat unpractical though, as most tree-handling code would have
to be full of 'nontail'.
Perhaps a more practical approach would be to have this only at the
documentation level, i.e. Mezzo's equivalent of ocamldoc would show a red 'non
tail recursive' marker in the function's doc to alert users to the
non-tail-recursive functions (and a green tail-recursive marker for others).
In fact this might be a nice improvement to ocamldoc too.
Best regards,
--Edwin
next prev parent reply other threads:[~2013-05-20 15:17 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
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 [this message]
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=519A3EA2.9080804@etorok.net \
--to=edwin+ml-ocaml@etorok.net \
--cc=caml-list@inria.fr \
/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