Eliminating code duplication for static/nonstatic functions
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Sep 20 08:22:25 PDT 2013
On 9/20/13 12:34 AM, Kenji Hara wrote:
> Just an idea: string mixin + UDA?
>
> @mixin(hasState ? "" : "static")
> int method() { return 1 + _theT.method(); }
That would be nice but would be a language change (and a subtle one...
now we have @mixin which introduces attributes that themselves may or
may not start with "@").
I decided to go with a slightly different design, but the problem
remains - there is no simple way to introduce conditional attributes and
qualifiers.
Andrei
More information about the Digitalmars-d
mailing list