Destructors, const structs, and opEquals
so
so at so.do
Fri Dec 10 16:44:28 PST 2010
> I agree with don.
> IMHO, this is incredibly silly given Andrei's use case, since D can have
> instead:
> void foo(const Widget);
> and have an optimization inside the compiler for value types to pass by
> ref.
>
> by specifying "const ref" you explicitly require that only a ref to an
> l-value be provided, whereas without the "ref" an r-value is also
> allowed a-la c++.
>
> much KISSer.
"auto ref" as a syntax may be not the best choice but the way it solves
the problem is very elegant.
your "const ref":
It doesn't make it KISS.
It adds inconsistency (even though it is necessary sometimes, this one is
bad).
You lose the ability to do the opposite.
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Digitalmars-d
mailing list