On 7/29/2016 1:34 AM, Jonathan M Davis via Digitalmars-d wrote:
I've always looked at D's ref as being essentially the same as C++'s &
except that it's not considered to be part of the type, just attached to it
in a way that doesn't propagate. The same with with in or out. I just don't
see how it even makes conceptual sense for ref to be an attribute of the
function itself.

C++'s & is a bizarre type constructor in that it has completely wacky and special cased behavior in just about everything involving types, including type deduction, type inference, overloading, etc. For example, you can't have a pointer to a ref. Or a ref of a ref. Sometimes the ref is considered part of the type, sometimes not. Etc.

With D, making it a sort of storage class completely sidesteps that mess.

Reply via email to