| Anonymous | Login | Signup for a new account | 2013-05-25 19:04 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 | |||
| 0003601 | OCaml | OCaml general | public | 2005-04-19 15:50 | 2010-04-30 08:28 | |||
| Reporter | administrator | |||||||
| Assigned To | garrigue | |||||||
| Priority | normal | Severity | feature | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | ||||||||
| Target Version | Fixed in Version | 3.12.0+dev | ||||||
| Summary | 0003601: "type ... and ..." is not commutative | |||||||
| Description | Full_Name: Francois Pottier Version: 3.08+alpha1 (2004-07-03) OS: RedHat Linux 8 Submission from: madiran.inria.fr (128.93.8.77) Mutually recursive data type definitions, written using "type ... and ...", are not commutative, even though one might expect them to be. This is illustrated by the following two code snippets. Snippet 1: # type t = { foo: t} and u = { foo: u };; type t = { foo : t; } and u = { foo : u; } # fun x -> x.foo;; - : t -> t = <fun> Snippet 2: # type u = { foo: u } and t = { foo: t };; type u = { foo : u; } and t = { foo : t; } # fun x -> x.foo;; - : u -> u = <fun> Suggested solution: detect that a record label is being defined twice in this mutually recursive definition and reject the program. Do the same for data constructors. Note: this is not a theoretical example! I have actually written code like this and got a type error much later in the program. | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0000256) administrator (administrator) 2005-04-27 14:39 |
The documentation doesn't say it's supposed to be commutative... |
|
(0005426) garrigue (manager) 2010-04-30 08:02 |
Added a check for duplicates in revision 10331. This is a hard error. One might prefer a warning, but currently there is no way to use such duplicates. |
|
(0005428) garrigue (manager) 2010-04-30 08:28 |
After some hesitation, I downgraded it to a warning, as programming style may change in the future. (revision 10332) |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-11-18 10:13 | administrator | New Issue | |
| 2010-04-30 08:00 | garrigue | Status | acknowledged => assigned |
| 2010-04-30 08:00 | garrigue | Assigned To | => garrigue |
| 2010-04-30 08:02 | garrigue | Note Added: 0005426 | |
| 2010-04-30 08:02 | garrigue | Status | assigned => resolved |
| 2010-04-30 08:02 | garrigue | Fixed in Version | => 3.12.0+dev |
| 2010-04-30 08:02 | garrigue | Resolution | open => fixed |
| 2010-04-30 08:28 | garrigue | Note Added: 0005428 | |
| 2010-04-30 08:28 | garrigue | Status | resolved => closed |
| Copyright © 2000 - 2011 MantisBT Group |