Nothing is wrong really. Though I'd feel weird if the Unit
is introduced solely for this usage.
And if we're to change the set
semantic we might as well do that. If I interpret @John_McCall's post here correctly, that may not be off the table. Though after re-reading it, I could be totally off the mark there .
I mean that we can either introduce set throws
with different semantic and be inconsistent with set
, or retroactively change set
semantic which is source breaking (or do something else).
The setter is called with the value being whatever it is right before the throw happens.