From: Alain Frisch <Alain.Frisch@inria.fr>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] beginner question: DAGs w/ recursive types an encapsulation of a Map
Date: Sun, 06 May 2007 09:54:29 +0200 [thread overview]
Message-ID: <463D89B5.5060309@inria.fr> (raw)
In-Reply-To: <200705060439.41842.jon@ffconsultancy.com>
Jon Harrop wrote:
> # type tree' = int * (char * tree') list ;;
> type tree' = int * (char * tree') list
>
> This is not "unsafe" in the usual sense of the word but it means that the
> compiler will be less friendly on all of the rest of your code.
The declaration is not "unsafe" by itself, but the -rectypes option is,
in the sense that it will make the compiler accept programs that will
produce infinite loops in the run-time system:
http://caml.inria.fr/pub/docs/manual-ocaml/libref/Lazy.html
<< Note: if the program is compiled with the -rectypes option,
ill-founded recursive definitions of the form let rec x = lazy x or let
rec x = lazy(lazy(...(lazy x))) are accepted by the type-checker and
lead, when forced, to ill-formed values that trigger infinite loops in
the garbage collector and other parts of the run-time system. Without
the -rectypes option, such ill-founded recursive definitions are
rejected by the type-checker. >>
(One might argue that the type checker does not reject non-terminating
programs anyway.)
-- Alain
next prev parent reply other threads:[~2007-05-06 7:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-04 23:46 Justin Corn
2007-05-05 0:59 ` [Caml-list] " Gabriel Kerneis
2007-05-06 3:33 ` Pablo Polvorin
2007-05-06 3:39 ` Jon Harrop
2007-05-06 7:54 ` Alain Frisch [this message]
2007-05-06 8:05 ` skaller
2007-05-05 7:10 ` Jean-Christophe Filliatre
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=463D89B5.5060309@inria.fr \
--to=alain.frisch@inria.fr \
--cc=caml-list@yquem.inria.fr \
--cc=jon@ffconsultancy.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