| Anonymous | Login | Signup for a new account | 2013-05-22 08:10 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
| 0005924 | OCaml | OCaml typing | public | 2013-02-17 16:48 | 2013-02-18 01:22 | |||||||
| Reporter | jpdeplaix | |||||||||||
| Assigned To | garrigue | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||||||
| Status | resolved | Resolution | won't fix | |||||||||
| Platform | OS | OS Version | ||||||||||
| Product Version | 4.00.1 | |||||||||||
| Target Version | Fixed in Version | |||||||||||
| Summary | 0005924: Adding expressiveness to polymorphic variants | |||||||||||
| Description | Hi, I'd like to be able to do the kind of functions described here: http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html [^] This function: let f = function `A -> `C | `B -> `D | x -> x is typed as: val f : ([> `A | `B | `C | `D ] as 'a) -> 'a but a more fine type would be: val f : [ `A | `B | 'r ] -> [ `C | `D | 'r ] gasche already told me that it is choice made by the caml developers, but I'm very interested in making such functions. So, if someone can add this expressiveness to the language or explain me why it is really not possible to add this, it would be very helpful. | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Notes |
|
|
(0008854) garrigue (manager) 2013-02-18 01:22 |
This is not strictly impossible to do that, but this requires huge changes in the type system. * since we would have explicit row variables, you need to introduce a notion of type variable sort * one would need to add exclusion information on row variables. For instance, with your example, we would the information that 'r cannot contain any of `A, `B, `C, `D. This is implicit in the type of f, but it can become hidden in more complex functions, so it would have to be explicit. * typing of pattern-matching would have to compute remaining cases, which is not trivial in the general case. For all these reasons there is no plan to introduce something like that at this point. If you are interested in this subject, you can read papers by Didier Rémy and, more recently, Matthias Blume. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2013-02-17 16:48 | jpdeplaix | New Issue | |
| 2013-02-18 01:22 | garrigue | Note Added: 0008854 | |
| 2013-02-18 01:22 | garrigue | Status | new => resolved |
| 2013-02-18 01:22 | garrigue | Resolution | open => won't fix |
| 2013-02-18 01:22 | garrigue | Assigned To | => garrigue |
| Copyright © 2000 - 2011 MantisBT Group |