<div class="gmail_quote">On 12 May 2012 12:43, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com" target="_blank">jmdavisProg@gmx.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 Saturday, May 12, 2012 12:37:12 Manu wrote:<br>
> On 12 May 2012 12:26, Timon Gehr <<a href="mailto:timon.gehr@gmx.ch">timon.gehr@gmx.ch</a>> wrote:<br>
> > On 05/12/2012 10:13 AM, Manu wrote:<br>
> >> On 11 May 2012 21:28, Mehrdad <<a href="mailto:wfunction@hotmail.com">wfunction@hotmail.com</a><br>
> >><br>
</div><div class="im">> >> <mailto:<a href="mailto:wfunction@hotmail.com">wfunction@hotmail.com</a>>**> wrote:<br>
> >>    Yes, I agree, but consider that D users should NOT have to work with<br>
> >>    pointers to do something so basic<br>
> >><br>
> >> I'd like to think this were true, but the fact that 'ref' barely works<br>
> >> makes this almost immediately false when trying to write any non-trivial<br>
> >> program.<br>
> ><br>
> > It depends on the coding style.<br>
><br>
> If the distinction is whether one likes to have data structures in their<br>
> code or not, I reckon there's a reasonably large user base in the former? :)<br>
> Once you use 'struct' you can't avoid pointers, given that ref just doesn't<br>
> work in many (perhaps most) situations.<br>
<br>
</div>Since structs are generally value types, it's extremely common to just pass<br>
them by value - so no refs or pointers are involved.</blockquote><div><br></div><div>... no. structs are for storing structured data. They may be rather large, they may aggregate smaller structs. In my entire career as a programmer, I can count the number of times I've wanted to pass a struct by value on perhaps one hand.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I _rarely_ need pointers<br>
for structs, and I don't need ref for them all that often either.</blockquote><div><br></div><div>If you need pointers at all, and you want to stick with D's modern pointers-shouldn't-appear-in-day-to-day-code idiom, then you need ref.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> And aside<br>
from the need to duplicate functions which take const ref so that they work<br>
with rvalues, I don't know what about ref you could think doesn't work.<br></blockquote><div><br></div><div>That's not a solution, it's not even a work around, it's a totally different operation. I may not want to, or can't, pass my data by value.</div>
</div>