On 12/29/14 8:10 PM, Manu via Digitalmars-d wrote:
On 30 December 2014 at 07:29, Steven Schveighoffer via Digitalmars-d
<digitalmars-d@puremagic.com> wrote:
On 12/29/14 3:42 PM, Dicebot wrote:
I think it wouldn't be a bad idea to investigate a new way to express
attributes, but I think no matter what we do, we need to rein in the
explosion of attributes that needs to be put on every function.
The approach is to infer everything, right?
The only time you are required to make it explicit is when it's an
important detail of your API, and you want to receive compile errors
when you violate such explicit request.
This only works for templates. Unless we devise a new object scheme and
linker...
But I agree. The problem is, most times, you WANT to ensure your code is
@safe pure nothrow (and now @nogc), even for template functions. That's
a lot of baggage to put on each signature. I just helped someone
recently who wanted to put @nogc on all the std.datetime code, and every
signature had these 4 attributes except a few. I tried to have him put a
big @safe: pure: nothrow: @nogc: at the top, but the occasional
exceptions made this impossible.
It's unfortunate we couldn't start with these being the defaults, and
then add the occasional @system, @unpure, and @throws where appropriate.
Some mechanism of aliasing attribute combinations is itching to get done :)
-Steve