When does final mean "maybe, kinda, sorta" ?
Sean Kelly
sean at f4.ca
Tue Jan 23 00:43:44 PST 2007
kris wrote:
> 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.
>
> 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.
The spec does this in a number of places. For example:
const auto static auto const auto i = 5; // what is i?
More information about the Digitalmars-d
mailing list