<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>Well, there are many times I'd rather have 'this' passed by value for efficiency!</span></div><div><br><span></span></div><div><span>Const ref would fit the bill nicely, if it didn't affect the type.<br></span></div><div><br><span></span></div><div><span>What would be interesting is if there was a way to say "this won't change in this function", and then the compiler could choose to pass by ref or value depending on which was more efficient, while still enforcing the property that the value doesn't change.</span></div><div><br><span></span></div><div><span>Hm.. could there be a library solution?<br></span></div><div><br><span></span></div><div><span>-Steve</span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-family: arial,
 helvetica, sans-serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Sean Kelly <sean@invisibleduck.org><br> <b><span style="font-weight: bold;">To:</span></b> Steve Schveighoffer <schveiguy@yahoo.com>; Discuss the dmd beta releases for D <dmd-beta@puremagic.com> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, April 16, 2012 2:31 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [dmd-beta] rvalue references<br> </font> </div> <br>
On Apr 16, 2012, at 6:32 AM, Steve Schveighoffer wrote:<br>> <br>> Regardless of the solution, I think we need to designate two different situations:<br>> <br>> 1. I want to pass this by reference because it's more efficient<br>> 2. I want to pass this by reference because I want to change it<br><br>Ideally, no one should ever specify "ref" simply for efficiency.  The programmer should choose semantics for logical reasons, and leave optimization up to the compiler.  That may still not be practical however.<br><br><br> </div> </div> </blockquote></div>   </div></body></html>