Neat 0.4.3: Fixing else for once
·
176 commits
to master
since this release
Minor bugfix: In a if x else b
and a else b
, b
is now correctly refcounted if it is a
local variable.
State of play is still:
auto var = obj?.field? else return false;
if (auto var = obj?.field?) { }
The compiler has been ported to use this idiom internally: field.notNull
has been replaced across
the board with the somewhat more ruthless, if accurate, field? else die
(die
being a thin wrapper around exit(1)
). The relevant commit serves as a practical demonstration of breakelse
in the guise of ?
.
Note that ?
is overloaded between error propagation and breakelse
handling: it will return errors from
a sumtype, and it will treat nullable T
as a sumtype of (T | null)
and breakelse
the null,
but not both at once. This occasionally necessitated the appropriately-irate fun()?? else die
.