Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undocumented behavior with extension constructors added to abstract types #6603

Closed
vicuna opened this issue Oct 8, 2014 · 1 comment
Closed
Assignees

Comments

@vicuna
Copy link

vicuna commented Oct 8, 2014

Original bug ID: 6603
Reporter: @alainfrisch
Assigned to: @lpw25
Status: assigned (set by @alainfrisch on 2014-10-08T08:20:43Z)
Resolution: open
Priority: normal
Severity: minor
Category: documentation
Monitored by: @gasche

Bug description

The behavior of extension constructor definitions/declarations when the target type is an abstract one is not documented in the manual. The behavior is:

  • In structures, it is allowed to rebind existing constructors to a type which is abstract in the current scope; it is not allowed to add new constructors, tough.

  • In signatures, it is possible to specify constructors added to an abstract type.

The following is thus accepted:

module type S = sig  type t  type t += A  end;;
module F(X : S) : S =  struct type t = X.t  type t += A = X.A  end;;

I assume that the rationale is to allow "sealing" an extensible type in a signature (together with a list of known constructors) , while allowing from the outside to expose subsets of its known constructors.

I suggest to describe the behavior in the manual, and give hints of situations where declaring extension constructors on abstract types is useful.

@yallop
Copy link
Member

yallop commented Apr 8, 2019

Fixed by #1253.

@yallop yallop closed this as completed Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants