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
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.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: