Should out/ref parameters require the caller to specify out/ref like in C#?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Mon May 29 00:51:13 PDT 2017


On Monday, May 29, 2017 07:39:40 Dukc via Digitalmars-d wrote:
> But what would be worth a consideration, is that perhaps one
> should be allowed to pass rvalues as reference with something
> like this? According to TDPL, ref arguments do not take rvalues
> to prevent bugs where you accidently copy something before
> passing it, and that's a good rationale. But shouldn't it still
> be allowed explicitly?

I expect that we're going to see a DIP related to rvalue references at some
point here, because some of the folks (particularly the game folks) think
that it's critical to be able to have a function that doesn't care whether
it's taking a value by value or by ref - just that it takes it efficiently,
and they don't want to be forced to use auto ref to do it (since that
requires templates).

- Jonathan M Davis



More information about the Digitalmars-d mailing list