Things that make writing a clean binding system more difficult

Manu via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 4 05:52:29 PDT 2016


On 29 July 2016 at 19:55, Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> 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.

But introduces a MUCH bigger mess in its place. D's ref is absolute
torture past the most simple of cases. The design doesn't scale, it's
one gigantic uncontrollable edge case built into the core of the
language, with no tools to wrangle or manage. I've never had such an
agonizing time with C++'s & as I have with ref in D, and I've had a
LOT of agonizing time with C++ ;)


More information about the Digitalmars-d mailing list