DIP 1016--ref T accepts r-values--Community Review Round 1

Manu turkeyman at gmail.com
Fri Jul 20 17:11:05 UTC 2018


On Fri, 20 Jul 2018 at 02:05, Dukc via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Friday, 20 July 2018 at 05:16:53 UTC, Mike Parker wrote:
> > This is the feedback thread for the first round of Community
> > Review for DIP 1016, "ref T accepts r-values"
>
> I'd prefer a solution which allows one to make an invisible temp
> manually without making a new statement or a new symbol name. By
> appending something (like .byRef or byRef!long, the latter making
> an implicit type conversion) after a rvalue statement. This would
> still prevent things like byRefFunction(aVariable.incremented)
> when incremented copies the value without the user excepting it.

This undermines one of the core reasons for the DIP; you're just
substituting one awkward edge case with a different awkward edge case.
Meta code is much simpler and less error-prone when there aren't
syntactic edge cases associated with interacting with ref args, and as
soon as they exist, library authors write some template without such
explicit support for reference args (perhaps they never thought of
it), and the end-user experiences nasty surprises.

> But If the options are either your solution or the present
> situation, yours is still better. Thanks for the effort to make
> it... I believe Manu will be pleased.

I'll be pleased if it doesn't get rejected on principle ;)


More information about the Digitalmars-d mailing list