<div class="gmail_quote">On 16 March 2012 17:14, Adam D. Ruppe <span dir="ltr"><<a href="mailto:destructionator@gmail.com">destructionator@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Friday, 16 March 2012 at 15:10:06 UTC, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Interesting approach, how will that affect 'thing's type?<br>
</blockquote>
<br></div>
It will strictly be myAttribute!int, but alias this<br>
means that you can pass it anywhere an int is expected<br>
too (and assign ints to it all the same).<br>
<br>
Check it:<br>
<br>
void cool(int a) {}<br>
void main() {<div class="im"><br>
        myAttribute!int thing;<br>
        thing.refresh = true;<br>
<br></div>
        thing = 10; // we can assign ints to it, like if it was an int<br>
        assert(thing.bNeedsAttention); // should be unchanged<br>
<br>
        int a = thing; // no problem, thing is usable as an int<br>
        assert(a == 10);<br>
<br>
        cool(thing); // ditto<br>
}<br>
</blockquote></div><br><div>I can see that it might work nicely in very simple cases, but it could get nasty in complex constructs. If some template tries to take the typeof for instance, now I'm cloning the attributes functionality too, which I don't think is desirable...</div>