You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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!
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.
The text was updated successfully, but these errors were encountered: