www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.internals - Functional techniques in dmd

reply Walter Bright <newshound2 digitalmars.com> writes:
https://github.com/dlang/dmd/pull/8493

It's a small change, but it illustrates an important concept - separating code 
into functions that calculate things (which can be made pure) and functions
that 
modify state.

Doing this more generally will significantly reduce the cognitive complexity of 
the compiler.
Jul 12 2018
parent Stefan Koch <uplink.coder googlemail.com> writes:
On Thursday, 12 July 2018 at 23:58:23 UTC, Walter Bright wrote:
 https://github.com/dlang/dmd/pull/8493

 It's a small change, but it illustrates an important concept - 
 separating code into functions that calculate things (which can 
 be made pure) and functions that modify state.

 Doing this more generally will significantly reduce the 
 cognitive complexity of the compiler.
It obvious that the compilation-process is in essence a pure function mapping source_code to machine_code. Therefore this is theoretically applicable to most of the compiler.
Jul 16 2018