Caching in computing ranges (and contributing to Phobos)
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Oct 9 15:46:32 PDT 2010
On 10/9/10 16:06 CDT, Tomek Sowiński wrote:
> Peter Alexander napisał:
>
>> On 9/10/10 8:58 PM, Pelle wrote:
>>> How about never having caches and if you need them, you can get a
>>> cached(map(..etc..))?
>>>
>>> I do not understand where the notion that ranges should have caches come
>>> from. It destroys the possibility for using const and complicates the
>>> writing of them.
>>
>> I agree with this. Caching should not be a default.
>>
>> As it stands, I know that std.algorithm.Map uses a cache, I haven't
>> checked any others.
>
> std.range.Sequence also caches. I swear I saw Zip do it too, but looking at the code now, I
> see no cache.
>
> By the way, I've been reading Phobos quite intensively lately and I'm willing to spend some
> time to make the change Pelle was talking about (remove caching, add the Cached higher-
> order range).
>
> How can I contribute that to Phobos?
Thanks for offering. Patches or simple snippets meant to replace
well-defined parts of existing code should be fine. But in this case
(i.e. caching) where the replacement is trivial, a bug report would be
sufficient and most appreciated.
Andrei
More information about the Digitalmars-d
mailing list