<div dir="ltr">On 8 April 2013 20:10, Dicebot <span dir="ltr"><<a href="mailto:m.strashun@gmail.com" target="_blank">m.strashun@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Monday, 8 April 2013 at 09:41:05 UTC, Jacob Carlborg wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 2013-04-08 11:17, Dicebot wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
b) You are forced to make function templated to mark it as @nogc. Bad.<br>
</blockquote>
<br>
It depends on how it's used. If it's enough to annotate a type the function doesn't need to be templated. This should work just fine: <br>
<br>
class Foo { }<br>
<br>
struct ThreadSafe (T)<br>
{<br>
    T t;<br>
}<br>
<br>
ThreadSafe!(Foo) foo;<br>
<br>
void process (ThreadSafe!(Foo) foo) { /* process foo */ }<br>
</blockquote>
<br></div></div>
Hm, so you propose to use something like Malloced!Data / Stack!Data instead of marking whole function with @nogc? Interesting, I have never though about this approach, may be worth trying as proof-of-concept.<br>
</blockquote></div><br></div><div class="gmail_extra" style>It's such a dirty hack though ;) .. that does not give the impression, or confidence that the language addresses the problem. Actually, quite the opposite. If I saw that, I'd be worried...</div>
</div>