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

Alias built-in types and pre-defined exceptions in Pervasives #6655

Closed
vicuna opened this issue Nov 10, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Nov 10, 2014

Original bug ID: 6655
Reporter: dsheets
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2016-12-08T10:54:01Z)
Resolution: suspended
Priority: normal
Severity: feature
Version: 4.02.1
Category: standard library
Has duplicate: #5072
Monitored by: @whitequark dsheets @ygrek @dbuenzli @Chris00

Bug description

The core library http://caml.inria.fr/pub/docs/manual-ocaml/core.html encompasses built-in types, predefined exceptions, and the Pervasives module.

The built-in types and predefined exceptions may be shadowed.

The built-in types and predefined exceptions have associated documentation at the above URL but they don't have a corresponding mli location as they are built-in.

Because of these issues, I propose that Pervasives expose documented aliases for all built-in types and exceptions. This would provide a fixed, standard alias in the event of shadowing and a well-defined reference for these special types and exception constructors. The documentation of exceptions will have to be slightly expanded to mention that they are in fact aliases of the predefined exceptions as exception constructor equality is important but inexpressible in signatures. A link to the above page of the OCaml manual should also be included.

Steps to reproduce

Compare Pervasives to http://caml.inria.fr/pub/docs/manual-ocaml/core.html.

Additional information

I will produce a patch on demand if desired.

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 8, 2016

Comment author: @alainfrisch

I agree that it would make sense to have all builin types and exceptions be defined in Pervasives. Leo suggested (in #5072) to have these components really defined in Pervasives, not just as aliases to components in the "empty" environment. To avoid adding a new syntax, one could use:

type int = [%ocaml.builtin "int"]

Otherwise, a less invasive approach is simply to reexport, using "nonrec":

type nonrec int = int

This would be more backward compatible for people who are not opening Pervasives by default. Marking this as suspended for now, but a PR is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.