Ticket #214 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Clarify how guards handle exceptions

Reported by: stephan Owned by: stephan
Priority: minor Milestone: OTDT_1.2.8
Component: language Version: 1.2.7
Keywords: Cc:

Description

The language definition doesn't mention whether exceptions are allowed in a guard predicate expression. The compiler currently treats guards as boolean methods with no declared exceptions, which means:

  • a guard predicate cannot throw a checked exception
  • an unchecked exception within a guard will unexpectedly interrupt the control flow including the original base behaviour.

The first case causes some inconvenience if a guard wants to use a method that declares a checked exception, because the guard itself cannot syntactically catch the exception -> need to introduce a helper method.

The second case is unfortunate because the base behaviour should not be affected by an exception thrown in a guard -- the only effect of a guard should be to filter when callin bindings fire.

Change History

Changed 3 years ago by stephan

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to OTDT_1.2.8

Resolved by

Note: See TracTickets for help on using tickets.