rfc:check-operator

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rfc:check-operator [2024/12/16 13:17] – created mindplayrfc:check-operator [2025/04/03 13:08] (current) – external edit 127.0.0.1
Line 134: Line 134:
  
 (In some cases, the use of ''%%check%%'' might provide some minor performance improvement, by avoiding unnecessary capture or propagation of stack frames, in cases where expected error conditions can be handled locally - however, this is not a primary motivation for this feature.) (In some cases, the use of ''%%check%%'' might provide some minor performance improvement, by avoiding unnecessary capture or propagation of stack frames, in cases where expected error conditions can be handled locally - however, this is not a primary motivation for this feature.)
 +
 +==== Impact on the error suppression operator ====
 +
 +The ''@'' error suppression operator, when applied to a function call in a ''%%check%%'' expression (as in e.g. ''%%$user = check @loadUser(1)%%'') may suppress warnings or notices, altering the code path within that function.
 +
 +This has no bearing on the behavior of the ''%%check%%'' operator itself, which only handles ''%%Throwable%%'' values - if the function call with error suppression evaluates to ''null'', that value will pass through as the result of the expression.
 +
 +==== No impact on error handling ====
 +
 +The ''%%check%%'' operator is means of generating exceptions, not a means of handling them.
 +
 +If the ''%%check%%'' operator is applied to a function that throws an exception, the function call never returns, and so the ''%%check%%'' operator does not interfere with normal error propagation.
 +
 +Besides potentially generating an implicit ''%%throw%%'', the ''%%check%%'' operator has no influence on the behavior of ''%%try/catch%%'' blocks - exceptions generated by the ''%%check%%'' operator behave exactly like those generated by a ''%%throw%%'' statement.
 +
 +Use of the ''%%check%%'' operator does not interfere with the ''%%set_error_handler%%'' or ''%%set_exception_handler%%''.
 +
 +The ''%%check%%'' operator does not interfere with type-hint enforcement - a function that returns something invalid (according to its return type) will trigger an error, as usual.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
rfc/check-operator.1734355039.txt.gz · Last modified: 2025/04/03 13:08 (external edit)