mutable reference > pointer

Paulo Pinto pjmlp at progtools.org
Wed Jun 6 05:35:42 PDT 2012


On Wednesday, 6 June 2012 at 11:58:12 UTC, Dmitry Olshansky wrote:
> On 06.06.2012 15:45, Gor Gyolchanyan wrote:
>> I had this idea for a long time now and was trying to find a 
>> reason
>> why it was a bad idea.
>> I failed to find that reason, so here it is:
>>
>
> There is. For one thing I like pointer for being explicit about 
> dereferencing something. In this sense having ref arguments of 
> function is IMO step backwards:
> mutator(a, b);
> vs
> mutator(a, &b);
>
> which one more likely to mutate arguments?
> In today's D you'll never know.

I never had any issue with this in the Pascal language family.

You need anyway always to look the function code, as you cannot 
know
what other side-effects might also be affected by the function 
call.

Plus any modern IDE can show the definition as tooltip.

--
Paulo


More information about the Digitalmars-d mailing list