Use UFCS for reducing dependencies

Paul Backus snarwin at gmail.com
Mon Jul 18 13:43:40 UTC 2022


On Monday, 18 July 2022 at 12:55:39 UTC, rikki cattermole wrote:
>
> On 19/07/2022 12:46 AM, Paul Backus wrote:
>> Well, I don't know the algorithm for PNG decoding, so I don't 
>> know whether it requires an input range, a forward range, or a 
>> random access range.
>
> For AV handling, ranges are not the right tool for the job, too 
> inefficient.
>
> You want to be working with arrays directly.

You can have a fast path for arrays and fall back to the slower, 
more generic version for other ranges.

But yes, the whole point of ranges is to decouple your algorithm 
from the source of the data it operates on. If you *want* your 
algorithm to be coupled to a particular source of data, then 
ranges will only get in your way. (Although it may be worth 
asking yourself: are you really sure that's what you want?)


More information about the Digitalmars-d mailing list