<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 31 March 2014 13:32, Adam D. Ruppe <span dir="ltr"><<a href="mailto:destructionator@gmail.com" target="_blank">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="">On Monday, 31 March 2014 at 03:25:11 UTC, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I also feel quite dirty using pointers in D where there is a dedicated reference type available. I don't want * and & to appear everywhere in my D code.<br>
</blockquote>
<br></div>
structs can pretty easily be reference types too:<br>
<br>
struct RefType {<br>
   struct Impl {<br>
        // put all the stuff in here<br>
   }<br>
   Impl* impl;<br>
   alias impl this;<br>
<br>
   // add ctors and stuff that new the impl<br>
}<br>
</blockquote></div><br></div><div class="gmail_extra">And you think this is 'cool'?</div><div class="gmail_extra">The amount of boilerplate required makes C++ look neat and tidy. You've also truncated it significantly.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">class RefType</div><div class="gmail_extra">{</div><div class="gmail_extra">  // put all the stuff in here</div><div class="gmail_extra">}</div><div class="gmail_extra">
<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Why would anyone want to do all that crap? The reason is to overcome the limitations/restrictions of class... so just fix class?</div><div class="gmail_extra">
Or maybe improve struct, so that boilerplate can disappear.</div><div class="gmail_extra">Perhaps add a distinct ref type like MS did with '^' pointers in WinRT and managed C++?</div><div class="gmail_extra"><br></div>
<div class="gmail_extra">Either way, for my money, that code might appeal to a D nerd (because you 'can'!), but I find it acutely distasteful code otherwise.</div><div class="gmail_extra">No junior programmer would/should understand all that intuitively, and I would be embarrassed to show that to a non-D-user that I was trying to convince.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">If this pattern is recurring (it seems that it is), then I think it's clear sign of a chronic deficiency in D. It should probably be studied and addressed. I'm seeing it appear a lot.</div>
</div>