Closed thekid closed 6 years ago
Could be realized by an IIFE:
// Given this input...
$a ?? throw new \lang\IllegalArgumentException("X");
// ...the compiler would emit this:
$a ?? (function() { throw new \lang\IllegalArgumentException("X"); })()
Good blog article on throws expressions in C# 7.0
Stackoverflow question covering the problem:
https://stackoverflow.com/questions/9544976/using-throw-in-a-javascript-expression
In Kotlin, throw is an expression:
https://kotlinlang.org/docs/reference/exceptions.html#the-nothing-type
In a nutshell
Would be allowed for the ternary operator, the null-coalesing operator and inside of compact functions.
See also