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

showing option default in .mli (feature wish) #8402

Closed
vicuna opened this issue Dec 5, 2003 · 1 comment
Closed

showing option default in .mli (feature wish) #8402

vicuna opened this issue Dec 5, 2003 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Dec 5, 2003

Original bug ID: 1965
Reporter: administrator
Status: closed
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Henri Dubois-Ferriere
Version: 3.07+2
OS: RH7.2
Submission from: lcavpc14.epfl.ch (128.178.8.51)

It would be nice if the .mli file could express the default values for optional
arguments.
For example if my function is

let f ?(optarg=5) () = optarg + 3

currently i cannot express that the optarg has default 5 in the .mli (except as
a comment).

It would be nice to have a syntax for this, which would be verified to be
coherent (in the sense that the default given in the .mli must match the one in
the .ml) by the compiler.

I know that these default values are not "type information" per se, but if a
.mli signature is to contain all the information that a user needs to know to
use the module, then the information of default values is important.

@vicuna
Copy link
Author

vicuna commented Jul 2, 2004

Comment author: administrator

In general, the default value is an arbitrary expression, and we do not want to
include arbitrary expressions in interfaces (think about interface subtyping).
Moreover, the default value can depend on identifiers not mentioned in the
interface, e.g. function parameters, non-exported structure fields.

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

1 participant