DIP 1029---Add throw as Function Attribute---Community Review Round 1
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Tue Jan 14 17:23:49 UTC 2020
On Tuesday, 14 January 2020 at 17:01:42 UTC, bachmeier wrote:
> Is it a big deal? Maybe not, but it's strange to say "You can
> invert [random attribute] but no others." "Oh, why is that?"
> "Because that's all that was in the DIP." It's just sloppy and
> amateurish to design a language like that.
Yes, but that's not the answer, is it? The answer to "Why is
that?" is, possibly among other things, "Because it enables a
transition path to exceptions being opt-in rather than opt-out."
(Note there is no reason in principle why `nothrow` might not get
deprecated and dropped if such a transition actually happens, so
long run we may not end up with the one invertible attribute.)
However, that does raise a good piece of review feedback: is it
appropriate to introduce this new attribute as a DIP in its own
right, rather than as a migration path for the nothrow-by-default
DIP? Are there use-cases other than the transition that motivate
the `throw` attribute or make it valuable?
It would be good if the DIP could articulate those arguments if
they exist -- and if they do not, perhaps its acceptance should
be made conditional on the (not yet finalized) nothrow-by-default
>> No, you don't need to write up a DIP to counter a DIP, but
>> comprehensively introducing invertible attributes _will_ need
>> a DIP. So if you (or anyone else) thinks that is needed or
>> valuable, it's worth putting that DIP together.
> I don't even know if that's a good idea. All I'm asking for is
> a sensible argument in favor of adding an inverse of one and
> only one attribute. It makes absolutely no sense to me to have
> negation of nothrow but not nogc.
You could look at that from the opposite point of view: what's
the point in introducing an inverse to a particular attribute
unless it has a practical motivation beyond the concept that
"attributes should be invertible"?
FWIW I do think it would be helpful for the DIP to offer a
response to your question.
More information about the Digitalmars-d