Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004319OCaml~DO NOT USE (was: OCaml general)public2007-06-16 18:042015-12-11 19:07
Assigned Togarrigue 
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
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.
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".
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
2015-12-11 19:07 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker