|Anonymous | Login | Signup for a new account||2018-12-15 11:18 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0007866||OCaml||typing||public||2018-10-25 09:11||2018-10-25 16:43|
|Target Version||Fixed in Version|
|Summary||0007866: Optional argument type not printed|
|Description||In some cases the type of an optional argument cannot be printed.|
# type 'a opt = 'a option;;
type 'a opt = 'a option
# let foo (type a) ?(x : a opt) () = ();;
val foo : ?x:<hidden> -> unit -> unit = <fun>
This is because the type of the argument becomes `'a opt` instead of `'a option`. I suspect that the proper fix is to represent the types of optional arguments as `'a` instead of `'a option`.
|Tags||No tags attached.|
> cannot be printed.
I assume that the trouble is that the printer does not have access to the environment in order to unify the argument type with 'a option in order to extract 'a. Is that right? Could one use the environment provided by wrap_printing_env?
> I suspect that the proper fix is to represent the types of optional arguments as `'a` instead of `'a option`.
Do you mean splitting:
| Tarrow of arg_label * type_expr * type_expr * commutable
(** [Tarrow (Nolabel, e1, e2, c)] ==> [e1 -> e2]
[Tarrow (Labelled "l", e1, e2, c)] ==> [l:e1 -> e2]
[Tarrow (Optional "l", e1, e2, c)] ==> [?l:e1 -> e2]
in two constructors (or putting the first type_expr "under" the three constructors), so that the first type_expr can be given a different meaning?
> Is that right?
Essentially, although I would phrase it more in terms of wanting type printing to work without needing to perform invasive operations like unification on the types.
> Do you mean[...]?
I had in mind making the first type_expr part of the label type, and giving it a slightly different meaning in the optional case. It just seems a cleaner representation to me, but its probably a fairly invasive change.
|2018-10-25 09:11||lpw25||New Issue|
|2018-10-25 09:42||frisch||Note Added: 0019423|
|2018-10-25 11:04||lpw25||Note Added: 0019424|
|Copyright © 2000 - 2011 MantisBT Group|