Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004319OCamlOCaml generalpublic2007-06-16 18:042012-07-11 23:04
Reportereaubin 
Assigned Togarrigue 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.10.0 
Target VersionFixed in Version4.00.0+dev 
Summary0004319: Feature request: -dtypes preserve type variables names from annotations
DescriptionCould the -dtypes option preserve the name of type variables in annotations? E.g. I've a function

  let discriminate
    (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.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0004272)
xleroy (administrator)
2007-11-10 15:18

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.
(0005071)
bartjacobs (reporter)
2009-09-07 19:54

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".
(0007495)
garrigue (manager)
2012-06-01 09:38

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.

- Issue History
Date Modified Username Field Change
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
Powered by Mantis Bugtracker