So what does (inout int = 0) do?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 15 06:51:14 PDT 2016


On 04/15/2016 02:15 AM, Vladimir Panteleev wrote:
> On Friday, 15 April 2016 at 05:38:56 UTC, Andrei Alexandrescu wrote:
>> I think we should deprecate inout. For real. It costs way too much for
>> what it does. For all I can tell most of D's proponents don't know how
>> it works. -- Andrei
>
> What would replace it in the case of classes, where you can't have
> templated virtual methods? Perhaps a mechanism to declare a templated
> virtual function, and a list of instantiations which will go into the
> vtable?

You write several one-liners that forward to an internal template 
implementation.

> If we are to kill inout and replace it with something else, then it
> should support cases where inout failed, such as inout on the parameter
> of a delegate passed to the function (see: inout opApply).

I think we should kill it, period. No replacement is really needed, for 
the most part most problems with inout are complications caused by the 
very presence of inout.

C++ has no parameterization of qualifiers and lived with it like a guy 
lives with a bald spot on a butt cheek. There's not even a proposal I 
can remember to fix that. Those duplications are the least of C++'s, or 
any langauge's, problems.

inout must go.


Andrei



More information about the Digitalmars-d mailing list