[Issue 7724] 'final:' doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 22 04:01:20 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7724



--- Comment #13 from Manu <turkeyman at gmail.com> 2012-04-22 04:02:16 PDT ---
(In reply to comment #12)
> (In reply to comment #8)
> > I need to reiterate the consistency issue.  Other superfluous 
> > attributes appear to be silently ignored where they are not 
> > applicable.  __gshared makes no sense on a function, but it doesn't 
> > complain, as is static, shared, immutable, etc.
> 
> By "superfluous", do you mean "redundant" or "not making sense in the context"?
>  This is an important distinction to consider.

Both are true for other attributes. __gshared makes no sense applied to a
function, static applied at the global scope however is at least redundant,
maybe both.

I think it depends how you look at it. The colon syntax isn't really an
explicit application of an attribute to everything that follows (at least, it
doesn't seem to be that way for all other attributes at this time). The policy
already seems to be be defined as applying the attribute only those items it is
applicable to, the only exclusion at this time seems to be final.


> (In reply to comment #10)
> > It's clearly a bug. All other attributes work as expected.
> 
> Not sure what you mean by that....

'__gshared:' doesn't cause errors, neither does 'immutable:', or any others I
tried. They all have cases where they are not applicable, but they are silently
ignored, as final should be.


> (In reply to comment #11)
> > Seeing as DMD ignores most no-op attributes, I have no idea why 
> > this is the one where it suddenly decides that it should generate 
> > an error.  I think final on variables should just be ignored, in 
> > keeping with other attributes.
> 
> What particular "other attributes" are you talking about?

shared, __gshared, immutable at least.


> Thinking about it now, variables can't be overridden, and so essentially are
> already final.  Banning them from being declared final might be considered
> silly on this basis. So final on member variables is redundant,

Excellent point :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list