DIP60: @nogc attribute

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 15 13:10:37 PDT 2014


On Tue, Apr 15, 2014 at 07:57:58PM +0000, monarch_dodra via Digitalmars-d wrote:
[...]
> I have an issue related to adding an extra attribute: Attributes of
> non-template functions. Currently, you have to mark most functions as
> already pure, nothrow and @safe. If we are adding another attribute.
> Code will start looking alike this:
> 
> int someTrivialFunction(int i) @safe pure nothrow @nogc;
> 
> *If* we introduce "yet" another attribute, then I think it should be
> worth considering adding the simple "@infered" or "@everything"
> wildcard or something.
> 
> Having a function whose attributes takes more room than the signature
> proper is pretty bad :/
> 
> Kind of not *directly* related to @nogc, but this DIP adds relevance
> to the "issue".
> 
> I mean, if we want this to actually be useful in Phobos (or other), it
> will require *massive* tagging all over the place.

Is automatic inference of @nogc anywhere within our reach right now?
That would save us a lot of grunt work marking up template functions in
Phobos (and user code), not to mention the case of template functions
with alias parameters, for which manual marking of @nogc may not even be
possible.

But yeah, for non-template functions, some way of triggering attribute
inference would be very helpful. What about @auto?


T

-- 
Why are you blatanly misspelling "blatant"? -- Branden Robinson


More information about the Digitalmars-d mailing list