Refactoring Code
Walter Bright
newshound2 at digitalmars.com
Sun Mar 3 07:30:53 UTC 2024
On 3/2/2024 9:48 PM, Max Samukha wrote:
> I don't see how that is simpler than the original (given the lazily initialized
> dynamic array is replaced with a static one and the loop is replaced with an FP
> equivalent).
1. no need to manually verify that the array is in the same order as the enum.
2. no variables are declared
3. there's no concern about thread safety with the static variable initialization
4. no cast conversion, which has to be checked manually
More information about the Digitalmars-d
mailing list