DIP69 - Implement scope for escape proof references

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 8 13:06:56 PST 2014


On 12/8/2014 12:54 PM, Dicebot wrote:
> On Monday, 8 December 2014 at 19:44:48 UTC, Walter Bright wrote:
>> I agree it's a seductively simple idea. The trouble starts happening when you
>> start when making ref idempotent, when ref can only be at the 'head' of a data
>> structure, when trying to do type deduction of a ref type (do you get the ref,
>> or do you look 'through' the ref?), what happens with overloading, etc., and
>> on and on.
>
> But was there any reason why those traits (alien to type qualifiers) were
> pursued? What is the problem with `ref` simply meaning `non-null pointer` and
> allowing non-idempotent ref(ref(int))?

Because it isn't just a non-null pointer (and ref's can still be null in C++!), 
it's an auto-dereferencing pointer.


More information about the Digitalmars-d mailing list