|Anonymous | Login | Signup for a new account||2015-01-26 11:26 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004319||OCaml||OCaml general||public||2007-06-16 18:04||2012-07-11 23:04|
|Target Version||Fixed in Version||4.00.0+dev|
|Summary||0004319: Feature request: -dtypes preserve type variables names from annotations|
|Description||Could the -dtypes option preserve the name of type variables in annotations? E.g. I've a function|
(disc: ('t,int,'v) discriminable) (xs: 't list): 'v list list = ...
which gets shown as ('d, int, 'e) discriminable -> 'd list -> 'e list list by caml-types-show-type instead of ('t,int,'v) discriminable -> 't list -> 'v list list.
|Tags||No tags attached.|
It's an instance of a more general aspect of the OCaml printer for types, namely that it invents names 'a, 'b, etc, for type variables occurring in types. The infrastructure to record and propagate user-provided names is simply not there. I'm afraid it won't change any time soon, but leave this PR as a feature wish.
|Notice that F# does this: it preserves user-provided type variable names in error messages and IDE tooltips. It even issues a warning when it constrains a user-provided type variable, saying something like "the polymorphism of this function is less than what is indicated by the type annotations".|
In the upcoming ocaml 4.00, type names are kept during type inference, and they should also appear in .annot files.
Whether we should have a warning when instantiating user-named type variables is an open question.
In Standard ML this is an error to instantiate a provided type.
In OCaml type variables are handled just as unification variables, which can be freely instantiated, but since 3.12 one can also use explicitly polymorphic type annotations to prohibit instantiation.
|2007-06-16 18:04||eaubin||New Issue|
|2007-11-10 15:18||xleroy||Note Added: 0004272|
|2007-11-10 15:18||xleroy||Status||new => acknowledged|
|2009-09-07 19:54||bartjacobs||Note Added: 0005071|
|2012-06-01 09:38||garrigue||Note Added: 0007495|
|2012-06-01 09:38||garrigue||Status||acknowledged => resolved|
|2012-06-01 09:38||garrigue||Fixed in Version||=> 4.00.0+dev|
|2012-06-01 09:38||garrigue||Resolution||open => fixed|
|2012-06-01 09:38||garrigue||Assigned To||=> garrigue|
|Copyright © 2000 - 2011 MantisBT Group|