ref parameters: there is no escape

Timon Gehr timon.gehr at gmx.ch
Mon Aug 15 04:10:52 PDT 2011


On 08/15/2011 08:16 AM, Mehrdad wrote:
> On 8/14/2011 7:20 AM, Andrei Alexandrescu wrote:
>> Walter and I have had a long discussion and we thought we'd bring an
>> idea for community review.
>>
>> We believe it would be useful for safety purposes to disallow escaping
>> addresses of ref parameters. <snip>
>
> ... I hope you're joking.
>
> (1) I thought the whole point of D was that you didn't need pointers to
> program effectively?

Why would the change contradict this?

>
> (2) Isn't this what compiler **warnings** are for?

In a well designed language, warnings are useless. Either the code is 
well formed or it is not. All you will have to do to convince the 
compiler that what you are doing is safe is to insert a cast.


More information about the Digitalmars-d mailing list