<p dir="ltr"><br>
On 25 Sep 2014 15:50, "Walter Bright via Digitalmars-d" <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br>
><br>
> On 9/24/2014 1:15 PM, Manu via Digitalmars-d wrote:<br>
>><br>
>> Something like (whatever syntax you like):<br>
>><br>
>> int^ rcInt; // refcounted pointer to an int<br>
>> MyStruct^ rcStruct; // refcounted pointer to a struct<br>
>> MyStruct s; // normal value-type struct, but if the struct has<br>
>> opInc/opDec, the RC handling code in the compiler can implicitly<br>
>> generate calls to opInc/opDec on assignment, which will allow the<br>
>> struct to manage itself.<br>
><br>
><br>
> I think Microsoft's C++/CLI tried that mixed pointer approach, and it was a disaster. I don't have personal knowledge of this.</p>
<p dir="ltr">C++ doesn't have any notion of borrowing. Scope can (will?) fix a whole lot of existing problems, and also allow RC -> raw pointers work nicely.</p>
<p dir="ltr">Also, I have no experience that leads me to believe it was any sort of disaster. It would have been nice if it didn't imply com specifically, that's probably the real problem that got the bad press; ^ pointers are implicitly com, which I don't recommend repeating ;)</p>
<p dir="ltr">> I suspect I know why. C++ on DOS had mixed pointer types - the near and far thing. It was simply unworkable in C++. Sure, it technically worked, but was so awful trying to deal with "is my ref type near or far" that people just couldn't write comprehensible code with it.</p>
<p dir="ltr">I don't think this is the same thing. There's a practical and functional difference. People would definitely use it if they have it.</p>
<p dir="ltr">I don't think the MS problem was in any way related.</p>
<p dir="ltr">> Note that a ^ pointer will be a different size than a * pointer. Things go downhill from there.</p>
<p dir="ltr">Dynamic arrays are a different size from pointers, that never caused any problems. I can't imagine any issues from this.<br></p>
<p dir="ltr">Anyway, it hasn't been explored at length. If it has any chance then I'll put extensive thought into it.</p>