| Anonymous | Login | Signup for a new account | 2013-06-19 09:33 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 | |||
| 0004675 | OCaml | OCaml general | public | 2008-12-17 16:07 | 2009-12-08 17:49 | |||
| Reporter | Pascal Cuoq | |||||||
| Assigned To | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | 3.11.0+beta | |||||||
| Target Version | Fixed in Version | 3.12.0+dev | ||||||
| Summary | 0004675: Compiler fails to warn about pattern Top _ when Top is a 0-ary constructor | |||||||
| Description | # type t = Top | Base of int ;; type t = Top | Base of int # let f x = match x with Base _ -> 0 | Top _ -> 1 ;; Résultat obtenu : val f : t -> int = <fun> Résultat attendu : Error: The constructor Top expects 0 argument(s), but is here applied to 1 argument(s) | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Relationships |
|||||||||||||||||||||
|
|||||||||||||||||||||
Notes |
|
|
(0004804) doligez (manager) 2008-12-17 18:52 |
This is a feature that was implemented to facilitate automatic generation of OCaml code... |
|
(0004805) Pascal Cuoq (reporter) 2008-12-18 00:53 |
I can see how some camlp4 extensions may get lighter this way, but the principle behind any single OCaml warning is that it's better to alert the programmer at the first sign that she might be confused about her program (the earlier the better), and this feature is certainly not homogeneous with this (desirable) general principle. Shouldn't the pattern generated by camlp4 be something that does not coincide with something that a human programmer might write by accident and want to hear about? "Top _" is already as ugly as it gets, therefore if a camlp4 extension is generating this it does not look like a very big stretch to force it to generate "Top __" or "Top ((_))" or whatever other construct that 1) would also work if the constructor had arguments, so as not to return to the initial problem, and 2) no-one in her right mind would write. |
|
(0005023) Etienne Millon (reporter) 2009-07-15 15:51 |
I agree with Pascal Cuoq. It may be nice to factor some camlp4 code, but it creates a nasty compatibility issue. |
|
(0005150) doligez (manager) 2009-11-06 19:15 edited on: 2009-11-09 15:13 |
In 3.12.0, there will be a warning (off by default) for when you give an _ as argument to a constant constructor. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2008-12-17 16:07 | Pascal Cuoq | New Issue | |
| 2008-12-17 18:51 | doligez | Relationship added | related to 0004052 |
| 2008-12-17 18:52 | doligez | Note Added: 0004804 | |
| 2008-12-17 18:52 | doligez | Status | new => feedback |
| 2008-12-18 00:53 | Pascal Cuoq | Note Added: 0004805 | |
| 2009-02-16 10:05 | ertai | Relationship added | has duplicate 0004717 |
| 2009-07-15 15:06 | xclerc | Relationship added | has duplicate 0004835 |
| 2009-07-15 15:51 | Etienne Millon | Note Added: 0005023 | |
| 2009-11-06 19:02 | doligez | Relationship added | has duplicate 0004911 |
| 2009-11-06 19:15 | doligez | Note Added: 0005150 | |
| 2009-11-09 15:13 | doligez | Note Edited: 0005150 | |
| 2009-11-09 15:13 | doligez | Note Edited: 0005150 | |
| 2009-12-08 17:49 | doligez | Status | feedback => closed |
| 2009-12-08 17:49 | doligez | Resolution | open => fixed |
| 2009-12-08 17:49 | doligez | Fixed in Version | => 3.12.0+dev |
| Copyright © 2000 - 2011 MantisBT Group |