From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Jeremy Yallop <yallop@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Duplicate value specifications
Date: Thu, 23 Feb 2017 11:44:41 -0500 [thread overview]
Message-ID: <CAPFanBG0UUYd0oN+RxjEU2WPHOrMK3+t_PBjVR=DNUqm6hbUHw@mail.gmail.com> (raw)
In-Reply-To: <CAAxsn=Hw5tDVq4Qe40LZzHJ3y7DcHTeUj4LUOLZJxbEK2VKiXg@mail.gmail.com>
Historically my understanding is that the signature language mimicks
the structure language in this respect, and that while shadowing of
type declarations is rejected for soundness, shadowing of value
definitions (as structure items) are accepted as they are a somewhat
common pattern.
We discussed this indirectly in PR#5878 (
https://caml.inria.fr/mantis/view.php?id=5878 ). My personal belief
about "ideal OCaml" is that repeated declarations and definitions of
the same identifier (either at the type or value level) should be
allowed as long as they are "unifiable" (have an upper bound in the
definedness order), and that the effect should be identical to a
single declaration of the unified result (the upper bound). In this
world, you example is rejected because the two definitions are
incompatible.
(This definedness-order idea allows repeating the same type definition
twice, or giving once an abstract declaration and then a concrete
definition, or specifying the variance separately from the rest of the
declaration, or using "val x : ..." as an annotation followed by a
"let x = ..." definitions.)
On Thu, Feb 23, 2017 at 10:11 AM, Jeremy Yallop <yallop@gmail.com> wrote:
> Are duplicate value specifications a supported feature of signatures?
> Will the following program, which is currently accepted, continue to
> be accepted in future versions of OCaml?
>
> module type S = sig
> val x : int
> val x : bool
> end
>
> This is an artificial example, of course, but duplication can
> sometimes arise naturally through signature inclusion.
>
> --
> 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
prev parent reply other threads:[~2017-02-23 16:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-23 15:11 Jeremy Yallop
2017-02-23 16:44 ` Gabriel Scherer [this message]
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='CAPFanBG0UUYd0oN+RxjEU2WPHOrMK3+t_PBjVR=DNUqm6hbUHw@mail.gmail.com' \
--to=gabriel.scherer@gmail.com \
--cc=caml-list@inria.fr \
--cc=yallop@gmail.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