About structs and performant handling

deadalnix deadalnix at gmail.com
Sun Mar 10 19:18:45 PDT 2013


On Sunday, 10 March 2013 at 19:27:01 UTC, Namespace wrote:
>> Finally, I think this behavior is very dangerous. Pass by 
>> reference and value have very different. With that construct, 
>> you'll never know which one you get as the compiler decide ! 
>> If the compiler and not the programmer decide what the program 
>> does (not implementation wise, but semantically), we have a 
>> problem.
>
> Haven't you then not the same problems with 'auto ref'?
> But you could prohibit any manipulation of a '&' parameter. Eg. 
> you could make him 'scope' by default (if 'scope' will work 
> someday).

As said in another post, I think auto ref suffer pretty much the 
same problem, but it is less problematic as you can't see the 
result on rvalues anyway, so the compiler cannot really screw 
you. It has the inconvenience of taking by ref many thing that 
would benefit from pass by value.


More information about the Digitalmars-d mailing list