caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Smith <brian-l-smith@uiowa.edu>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Cyclic ?!
Date: Thu, 15 Aug 2002 13:16:09 -0500	[thread overview]
Message-ID: <3D5BEFE9.6080200@uiowa.edu> (raw)
In-Reply-To: <20020815180552.GB26027@fichte.ai.univie.ac.at>

Hi,

Markus Mottl wrote:
> On Thu, 15 Aug 2002, Oleg wrote:
> 
>>I'm not sure I understand you. If the two definitions are equivalent WRT 
>>Empty <-> None & Node <-> Some name substitution, then the fact that the 
>>compiler accepts one, but not the other must be a bug, yes?
> 
> This is not a bug, because you can have the compiler typecheck it using
> the command-line flag "-rectypes".
> 
> The problem rather is that programmers can accidently write down
> meaningless expressions for which the compiler infers absolutely crazy
> types. If I remember correctly, OCaml already had the more general rule
> by default in some ancient version, but the developers found that this
> generality caused more confusion than benefits to programmers...

But, if this is the case, then wouldn't that still apply to other parts 
of a program using recursive types? In other words, if I use one 
recursive type, then I must use -rectypes, but that means that the 
"extra strict checking" that O'Caml normally does won't help me in the 
rest of my program, where I might use recursive types accidently and 
thus cause O'Caml to infer "absolutely crazy types".

I think, instead of a command-line option, it would be better to provide 
a syntactical annotation on each type definition where this behavior is 
desired. That way, the default strict checking would always apply, but 
it can be overridden by somebody that knows they really really want a 
recursive type.

What do you think?

- Brian



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-08-15 18:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-15  2:19 Oleg
2002-08-15 14:31 ` Michael Hicks
2002-08-15 17:26   ` Oleg
2002-08-15 18:05     ` Markus Mottl
2002-08-15 18:16       ` Brian Smith [this message]
2002-09-24 16:23     ` [Caml-list] Recursive types (Was Cyclic ?!) Christophe Raffalli
2002-08-18 16:13 ` [Caml-list] Cyclic ?! John Max Skaller

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=3D5BEFE9.6080200@uiowa.edu \
    --to=brian-l-smith@uiowa.edu \
    --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;
as well as URLs for NNTP newsgroup(s).