Inout unclearness

Max Klimov via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 27 13:13:30 PDT 2015


On Sunday, 26 July 2015 at 13:06:50 UTC, Kagamin wrote:
> The example works like inout without inout, so you can use 
> types with templates and virtual functions.

Does constBack imply to have several static if constructions, 
function overloadings or template specializations? I mean does 
this help to reduce the amount of code? And it also sets aside 
the discussion about casting const away 
(http://forum.dlang.org/thread/riiehqozpkyluhhifwha@forum.dlang.org).

> You only hope it's the same.

I believe that generated code does not distinguish constness of 
object. Moreover, currently inout goes with one code, so it is 
possible.

All my questions and talks rose from inout restrictions on 
casting and keeping inside classes and structs. I'm not sure that 
they are needed. As for now, inout is quite useless for the cases 
little bit more complex than "inout(A) getData() inout { return 
data; }". It leads to templates overusage and code duplication. 
I'm not against inout, I'm for its improvement.




More information about the Digitalmars-d mailing list