Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005987OCamlOCaml documentationpublic2013-04-16 10:372013-07-12 18:15
Reporterfrisch 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version 
Target Version4.01.1+devFixed in Version 
Summary0005987: Constraints on type declarations can be of the form "typexpr = typexpr", not only "'ident = typexpr"
DescriptionThe manual says:

type-constraint ::= constraint 'ident = typexpr

but the parser recognizes:

constrain:
        core_type EQUAL core_type { $1, $3, symbol_rloc() }
;


(I wonder whether even the simpler form of constraints on type declarations is actually used...)
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0009130)
gasche (developer)
2013-04-16 11:45

Yes, I think constraints have some use (besides backporting a soundness bug to old OCaml versions in the raging bugtracker discussion). I personally used them in conjunction with phantom object types in Macaque, to get a form of type-level records:

type 'phant binary_op = 'a t -> 'b t -> 'c t
  constraint 'a = < t : 'in_t; nul : 'n; .. >
  constraint 'b = < t : 'in_t; nul : 'n; .. >
  constraint 'c = < t : 'out_t; nul : 'n >
  constraint 'phant =
    < in_t : 'in_t; out_t : 'out_t; nul : 'n; a : 'a; b : 'b >

(Only the last constraint is really necessary, the others are here for readability)
(0009562)
doligez (administrator)
2013-06-19 13:57

This appears to be deliberately documented that way. Should we change the documentation or restrict the parser?

- Issue History
Date Modified Username Field Change
2013-04-16 10:37 frisch New Issue
2013-04-16 11:45 gasche Note Added: 0009130
2013-06-19 13:57 doligez Note Added: 0009562
2013-06-19 13:57 doligez Status new => confirmed
2013-06-19 14:01 doligez Target Version => 4.02.0+dev
2013-07-12 18:15 doligez Target Version 4.02.0+dev => 4.01.1+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker