Things that make writing a clean binding system more difficult

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 29 02:55:14 PDT 2016


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.



More information about the Digitalmars-d mailing list