Metaprog can be abstruse

bauss jj_1337 at live.dk
Mon Jul 4 10:23:09 UTC 2022


On Monday, 4 July 2022 at 09:43:11 UTC, user1234 wrote:
> On Monday, 4 July 2022 at 09:40:45 UTC, Bastiaan Veelo wrote:
>> Not necessarily.
>> ```d
>> immutable decimalRanks = iota(10).map!(p => 10.pow(p)).array;
>> ```
>>
>> -- Bastiaan.
>
> Hi, to this alternative I'd say that it's not self documenting.
> So it still has 50% of the initial problem.

I think that depends on your expertise. It's self-document if you 
understand the functionality of iota, map, pow and array.

Saying it's not self documenting is the same as saying:

`writeln("Hello World!")` isn't self documenting, but I do 
believe we can both agree on that it pretty much is.

It's self documenting for the same reason, you understand the 
functionality behind writeln and thus knows what it is doing.

The same can be said about the above function chain.

It's very much straight-forward in what it's doing and it's only 
when one doesn't understand these "basic" functions that one 
don't find it self-documenting.


More information about the Digitalmars-d mailing list