When does final mean "maybe, kinda, sorta" ?
kris
foo at bar.com
Tue Jan 23 00:15:27 PST 2007
Sean Kelly wrote:
> kris wrote:
>
>> Andrei Alexandrescu (See Website For Email) wrote:
>>
>>> kris wrote:
>>> [snip]
>>> I agree about the misleading part, but I don't think that overriding
>>> private methods is poor practice. In fact I think it's rich practice
>>> :o). See e.g. http://www.gotw.ca/publications/mill18.htm.
>>>
>>> Andrei
>>
>>
>> Design philosophy aside, what should be done about the issues with
>> "final" itself?
>
>
> I think the current design is consistent but potentially confusing. If
> a function can be virtual (ie. if it is not private) then "final"
> controls whether it can be overridden. So making a private function
> final is meaningless because it cannot be overridden--in this case,
> "final" is simply ignored.
>
>
> Sean
Fair enough. Then the compiler should be a tad smarter about disallowing
'stupid' combinations of attributes. This applies to many other
attributes, not just final. People /will/ use whatever combination
they're allowed to, and the doc appears to encourage them to do so.
More information about the Digitalmars-d
mailing list