[dmd-beta] rvalue references
Steve Schveighoffer
schveiguy at yahoo.com
Mon Apr 16 11:38:14 PDT 2012
Well, there are many times I'd rather have 'this' passed by value for efficiency!
Const ref would fit the bill nicely, if it didn't affect the type.
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.
Hm.. could there be a library solution?
-Steve
>________________________________
> From: Sean Kelly <sean at invisibleduck.org>
>To: Steve Schveighoffer <schveiguy at yahoo.com>; Discuss the dmd beta releases for D <dmd-beta at puremagic.com>
>Sent: Monday, April 16, 2012 2:31 PM
>Subject: Re: [dmd-beta] rvalue references
>
>On Apr 16, 2012, at 6:32 AM, Steve Schveighoffer wrote:
>>
>> Regardless of the solution, I think we need to designate two different situations:
>>
>> 1. I want to pass this by reference because it's more efficient
>> 2. I want to pass this by reference because I want to change it
>
>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.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20120416/8b53b3dc/attachment.html>
More information about the dmd-beta
mailing list