Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006057OCamlOCaml typingpublic2013-06-28 09:542013-06-28 12:23
Reporterprotz 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0006057: « match e with p -> » does not generalize « e »
DescriptionIf I recall correctly my master's internship, there's no theoretical reason why the following should work:

# let x, y = (fun x -> x), fun x -> x;;
val x : 'a -> 'a = <fun>
val y : 'a -> 'a = <fun>


while the following does not:

# match (fun x -> x), fun x -> x with x, y -> x, y;;
- : ('_a -> '_a) * ('_b -> '_b) = (<fun>, <fun>)


In other words, when writing <tt>match e with p</tt>, <tt>e</tt> should be generalized.

Jacques, is that difficult to implement?
Additional Information(This was initially filed as a companion issue to 0006056 to make sure we have a separate bug for the separate issue.)
TagsNo tags attached.
Attached Files

- Relationships
related to 0006056resolvedgarrigue [non-expansivity issue] Using 'match' prevents generalization [of values], even though using 'if' allows it 
related to 0006014confirmedgarrigue Existentials not allowed with 'let and' 

-  Notes
(0009627)
frisch (developer)
2013-06-28 11:18

Adding a relation to 0006014, the common point being "bring the type-checking of 'let' and 'match' closer to each other."
(0009628)
gasche (developer)
2013-06-28 11:39

I plan to suggest a patch for this one bug (it seems very easy to fix). 0006506 seems more delicate.
(0009631)
garrigue (manager)
2013-06-28 12:23

Actually, e is already generalized, you could see in

match fun x -> x with f -> f 1, f true;;

What you are seeing in your example is just that the match construct itself is considered as expansive, which is an orthogonal issue (6056).

- Issue History
Date Modified Username Field Change
2013-06-28 09:54 protz New Issue
2013-06-28 09:54 protz Relationship added related to 0006056
2013-06-28 09:55 protz Description Updated View Revisions
2013-06-28 11:18 frisch Note Added: 0009627
2013-06-28 11:18 frisch Relationship added related to 0006014
2013-06-28 11:39 gasche Note Added: 0009628
2013-06-28 12:23 garrigue Note Added: 0009631
2013-06-28 12:23 garrigue Status new => resolved
2013-06-28 12:23 garrigue Resolution open => no change required
2013-06-28 12:23 garrigue Assigned To => garrigue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker