2015-06-04 22:41 GMT+09:00 Meta via Digitalmars-d <
digitalmars-d@puremagic.com>:

> It's still trivial to do this without allowing arbitrary expressions,
> since the expressions have to be CTFE-able.
>
> enum constIsEnabled = isConst!(_wrapped.front);
> auto front() const(constIsEnabled) { return _wrapped.front; }
>

In old days I thought a little more generic idea "compilable attribute".

For example:

    // label style.
    // `str` is a CTFEable expression that returns
    // "public", "final", or other built-in attribute name.
    mixin(str): void f1() {}

    // block style
    mixin(str) { void f2() {} }

    // prefix style
    mixin(str) void f3() {}

    // postfix style
    void f4() mixin(str) {}

Similar thing for UDAs

    // tuple contains CT entities that could be UDA.
    @mixin(tuple):

(Note that there's no consideration for feasibility).

But I couldn't find the use case of them.

Kenji Hara

Reply via email to