Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006423OCamllanguage featurespublic2014-05-14 16:272017-03-01 15:23
Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0006423: lazy exception patterns
DescriptionThe idea is to support exception matching under lazy patterns, as Alain proposed in discussion under PR6318. For example, we might write:

   match f e with
     lazy x, _ -> ...
   | lazy (exception Not_found), Some x -> ...
   | ...

Unlike top-level exception patterns which can only appear in 'match' and 'try', we can support exception pattern under lazy in any pattern context. For example,

   let (lazy (exception E)) = raise E in e

is equivalent to


Eventually lazy patterns could support or patterns for exception matching (cf. PR6422):

   match f e with
     lazy (None | exception Not_Found) -> ...
   | ...
TagsNo tags attached.
Attached Files

- Relationships
related to 0006422acknowledgeddoligez Support "exception" under or-patterns 
related to 0006318closedfrisch Extend try with "success" handling 

-  Notes
frisch (developer)
2015-01-12 13:01
edited on: 2015-01-12 13:59

I'm not sure about:

let (lazy (exception E)) = raise E in e

is equivalent to


The way I see it, this should rather let the exception escape. We should stick to the current meaning of lazy patterns: they match only lazy values. The only change is that right under the "lazy", you can specify "exception" pattern to account for the case the lazy value raises an exception when being forced.

yallop (developer)
2015-01-12 13:05

Agreed. Perhaps I meant to write

   let lazy (exception E) = lazy (raise E) in e

- Issue History
Date Modified Username Field Change
2014-05-14 16:27 yallop New Issue
2014-05-14 16:27 yallop Relationship added related to 0006422
2014-05-14 16:27 yallop Relationship added related to 0006318
2014-06-02 20:29 doligez Assigned To => doligez
2014-06-02 20:29 doligez Status new => acknowledged
2015-01-12 13:01 frisch Note Added: 0013062
2015-01-12 13:05 yallop Note Added: 0013063
2015-01-12 13:59 frisch Note Edited: 0013062 View Revisions
2015-02-06 19:27 doligez Assigned To doligez =>
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-01 15:23 doligez Category -OCaml general => language features

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker