About structs and performant handling

Namespace rswhite4 at googlemail.com
Mon Mar 11 03:55:49 PDT 2013


On Sunday, 10 March 2013 at 19:27:01 UTC, Namespace wrote:
> But you could prohibit any manipulation of a '&' parameter. Eg. 
> you could make him 'scope' by default (if 'scope' will work 
> someday).

A better solution would be to require that a Parameter with '&' 
need 'const scope' as storage class.
So the syntax would be:
void foo(in A& a) {
In my opinion, there is then no reason to worry about whether it 
is an lvalue or an rvalue. It cannot be changed or referenced.

This:
void foo(A& a) {
without const scope would cause an error like : "Error: '&' 
requires const scope."

AFAIK the syntax 'in ref' was suggested by Kenji but was rejected 
for some reasons.


More information about the Digitalmars-d mailing list