Final by default?
Michel Fortin
michel.fortin at michelf.ca
Fri Mar 14 08:40:49 PDT 2014
On 2014-03-14 15:17:08 +0000, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> said:
> A few possibilities discussed around here:
>
> !final
> ~final
> final(false)
> @disable final
>
> I've had an epiphany literally a few seconds ago that "final(false)"
> has the advantage of being generalizable to "final(bool)" taking any
> CTFE-able Boolean.
>
> On occasion I needed a computed qualifier (I think there's code in
> Phobos like that) and the only way I could do it was through ugly code
> duplication or odd mixin-generated code. Allowing computed
> qualifiers/attributes would be a very elegant and general approach, and
> plays beautifully into the strength of D and our current investment in
> Boolean compile-time predicates.
final(bool) is my preferred solution too.
It certainly is more verbose than 'virtual', but it offers more
possibilities. Also, the pattern is already somewhat established with
align(int).
--
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca
More information about the Digitalmars-d
mailing list