|
|
|
|
|
by WalterBright
10 days ago
|
|
Over the many years I was writing code in C, I noticed that the original program design and data structures were very persistent, i.e. they were never reorganized. I suspect the cause is the tendrils of those choices found their way into everything, so reorganizing it was thoroughly impractical. One of the problems, for C, is the use of . to access a field via a variable, and -> to access a field via a pointer. To switch between a pointer and a variable in a struct means you've got to re-edit large quantities of code everywhere. The result is just too tedious. This was the motivation in D for using . for both. It turns out, it is completely unnecessary for having both . and -> as the compiler semantic pass can trivially figure it out. Eliminating this issue makes for much easier redesign of a data structure. |
|
My mind equates -> to "this could be NULL" without ever looking at the function signature.
It is way more of a pain in the ass for refactors than = vs := though.