C is Brittle D is Plastic

Derek Fawcus dfawcus+dlang at employees.org
Sun Mar 22 17:19:26 UTC 2026


On Sunday, 22 March 2026 at 17:08:05 UTC, Derek Fawcus wrote:
> On Sunday, 22 March 2026 at 04:47:41 UTC, Walter Bright wrote:
>> To switch between reference and value, it's necessary to go 
>> through all the code swapping . and ->.
>
> Not really, if one has a little for-thought, and commits to 
> accessing the members via ->, the two become interchangeable, 
> with no performance impact.

One can even play macro games (using _Generic) to make a wrapper 
for the function, such that one does not even need to go through 
and update the call sites to add or remove the & .

However going back to the original point, as of late last year / 
early this year it is now obsolete.  That specific example of 
switching the code to use . or -> is something which the LLM 
assisted coding agents are particularly adept at.

Such refactoring tasks are what I've been using it for, where it 
is quite easy to specify some form of grep pattern and then rules 
to update the code.  So these days that'll take less than an hour 
to achieve.

DF


More information about the Digitalmars-d mailing list