On 4/16/12 4:21 PM, Michel Fortin wrote:
Did you notice the "ref struct" proposal I made a while ago on the
newsgroup? Basically you attach a flag to a struct declaration that'd
cause that struct to be automatically passed by ref when used as a
function argument. It's crude, but it'd be much less verbose than
writing 'ref' or 'auto ref' everywhere.
Walter convinced me a while ago that transparent pass by ref is
problematic. Consider:
struct S @pass_by_ref(true)
{
...
}
void fun(T)(T a, T b)
{
...
}
Inside fun, code is free to assume that &a != &b with quite important
consequences. If calling fun(s, s) ends up aliasing the two names to the
same thing, it will fail in difficult to figure ways.
Andrei
_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta