Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazy exception patterns #6423

Closed
vicuna opened this issue May 14, 2014 · 3 comments
Closed

lazy exception patterns #6423

vicuna opened this issue May 14, 2014 · 3 comments

Comments

@vicuna
Copy link

vicuna commented May 14, 2014

Original bug ID: 6423
Reporter: @yallop
Status: acknowledged (set by @damiendoligez on 2014-06-02T18:29:00Z)
Resolution: open
Priority: normal
Severity: feature
Category: language features
Related to: #6318 #6422
Monitored by: @whitequark @hcarty

Bug description

The 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

   e

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

match f e with
lazy (None | exception Not_Found) -> ...
| ...

@vicuna
Copy link
Author

vicuna commented Jan 12, 2015

Comment author: @alainfrisch

I'm not sure about:

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

is equivalent to

e

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.

@vicuna
Copy link
Author

vicuna commented Jan 12, 2015

Comment author: @yallop

Agreed. Perhaps I meant to write

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

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants