On Wednesday, 9 October 2013 at 14:11:46 UTC, Dicebot wrote:
On Wednesday, 9 October 2013 at 13:57:03 UTC, Sean Kelly wrote:
They aren't opt-out for really any reasonable project though,
because code is reused and those people may want at least the
standard attributes to be set. Personally, the array of
attributes that can be applied to a D function is one of my
biggest pet peeves with the language. It gains me nothing
personally, and adds a lot of extra thought to the process of
writing a function.
This is exactly what I was speaking about. It would have been
much more easy if stuff was `pure @safe immutable nothrow` by
default and one added `dirty @system mutable throw` on per-need
basis after getting compiler error. But that is too late to
change and this attribute inference may be only reasonable
option.
Maybe it's worth to introduce "pure: @safe: immutable: nothrow:"
on top of every module as the new recommended design pattern.
Will it work?
Then it may go through a deprecation phase, e.g. omitting it on
top of the module becomes a warning, then an error, then it
becomes the default.