Skip to content

Restrictions on exception match cases are too restrictive #6432

@vicuna

Description

@vicuna

Original bug ID: 6432
Reporter: @whitequark
Assigned to: @lpw25
Status: closed (set by @xavierleroy on 2015-12-11T18:27:06Z)
Resolution: duplicate
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Duplicate of: #6422
Monitored by: @diml @yakobowski

Bug description

I have observed that often, it is convenient to combine a catchall case with an exception case, e.g.:

match ExtUnix.All.uname () with
| { ExtUnix.All.Uname.sysname = "Linux" } ->
  List.fold_left Filename.concat [xdg_config_home; app; name]
| _ | exception (ExtUnix.All.Not_available _) ->
  List.fold_left Filename.concat [home; "." ^ app; name]

However, currently, it's not possible to have a toplevel alternation between an exception case and anything else. It doesn't make sense syntactically, and it's needlessly restrictive.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions