Jonathan M Davis:

> I see _zero_ reason to 
> treat a newly constructed object as any different from one which is returned 
> from a function.

I have not followed fully this thread, so I am not sure what you are talking 
about, so sorry if I am misunderstanding the whole topic.

I assume you want to disallow code like:

struct Vect {
    float[4] data = 0.0;
    // lot of operator overloading here, all arguments are by ref
}
void foo(ref Vect f) {}
void main() {
    foo(Vect([1,2,3,4]));
}

Such code is common. In foo() and in all the Vect operators ref is required for 
performance. This code is quite handy. Forcing me to define and assign a Vect 
to a temporary variable in main is not handy.

Think about writing expressions that use Vects with operator overloading, that 
use ref everywhere. If you can't pass and give Vects defined inside the 
expressions the code becomes quite more hairy.

Bye,
bearophile

Reply via email to