Blog post: What D got wrong

Walter Bright newshound2 at digitalmars.com
Mon Dec 17 20:16:08 UTC 2018


On 12/15/2018 11:53 AM, Atila Neves wrote:
> @safe and pure though...

@safe is not so hard to adopt, since by using @trusted one can proceed 
incrementally.

Going pure, however, is much harder (at least for me) because I'm not used to 
programming that way. Making a function pure often requires reorganization of 
how a task is broken up into data structures and functions.

For example,

https://github.com/dlang/dmd/blob/master/src/dmd/target.d

It's nearly all global variables that manipulate other global variables. I 
recently added a parameter to _init() so that it didn't need to access 
global.params.

Now if the Target.* __gshared's could instead be replaced with fields, then 
_init() could be made pure.


More information about the Digitalmars-d-announce mailing list