<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-06-04 22:41 GMT+09:00 Meta via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">It's still trivial to do this without allowing arbitrary expressions, since the expressions have to be CTFE-able.<br>
<br>
enum constIsEnabled = isConst!(_wrapped.front);<br>
auto front() const(constIsEnabled) { return _wrapped.front; }<br>
</blockquote></div><br></div><div class="gmail_extra">In old days I thought a little more generic idea "compilable attribute".</div><div class="gmail_extra"><br></div><div class="gmail_extra">For example:</div><div class="gmail_extra"><br></div><div class="gmail_extra"> // label style.<br></div><div class="gmail_extra"> // `str` is a CTFEable expression that returns</div><div class="gmail_extra"> // "public", "final", or other built-in attribute name.</div><div class="gmail_extra"> mixin(str): void f1() {}</div><div class="gmail_extra"><br></div><div class="gmail_extra"> // block style<br></div><div class="gmail_extra"> mixin(str) { void f2() {} }</div><div class="gmail_extra"><br></div><div class="gmail_extra"> // prefix style</div><div class="gmail_extra"> mixin(str) void f3() {}</div><div class="gmail_extra"><div class="gmail_extra"><br></div><div class="gmail_extra"> // postfix style</div><div class="gmail_extra"> void f4() mixin(str) {}</div><div><br></div><div>Similar thing for UDAs</div><div><br></div><div> // tuple contains CT entities that could be UDA.<br></div><div> @mixin(tuple):</div><div><br></div><div>(Note that there's no consideration for feasibility).<br></div><div><br></div><div>But I couldn't find the use case of them.</div><div><br></div><div>Kenji Hara</div></div></div>