Thread overview
Component programming with ranges
Aug 06, 2013
bearophile
Aug 07, 2013
Ali Çehreli
Aug 07, 2013
Jos van Uden
Aug 09, 2013
Nick Sabalausky
August 06, 2013
Vote up!

http://www.reddit.com/r/programming/comments/1jtzez/component_programming_with_ranges/ 


Andrei


August 06, 2013
Andrei Alexandrescu:

> http://www.reddit.com/r/programming/comments/1jtzez/component_programming_with_ranges/

It's an interesting article, but I wrote some comments. Not even some answers before posting that to Reddit?

http://forum.dlang.org/thread/20130802052432.GA495@quickfur.ath.cx#post-ibbicmqochwtirxdbmud:40forum.dlang.org

Bye,
bearophile
August 07, 2013
On 08/06/2013 12:56 PM, Andrei Alexandrescu wrote:
> Vote up!
>
> http://www.reddit.com/r/programming/comments/1jtzez/component_programming_with_ranges/
>
>
> Andrei
>
>

This article is excellent.

Some notes:

1) More recent versions of std.datetime makes it possible to write 1.days instead of dur!"days"(1)

From:

        .recurrence!((a,n) => a[n-1] + dur!"days"(1))

To:
        .recurrence!((a,n) => a[n-1] + 1.days)

2) It is mildly annoying that sometimes it is more convenient to do non-trivial processings in .front rather than .popFront. The problem of doing so is that the user of the code may call .front multiple times assuming that the result is a reference to an already processed data when in fact each call consumes CPU cycles.

3) I haven't compiled the code but it looks like some of the signature constraints can be simplified by taking advantage of isDateRange() more.

Ali

August 07, 2013
On 6-8-2013 21:56, Andrei Alexandrescu wrote:
> Vote up!
>
> http://www.reddit.com/r/programming/comments/1jtzez/component_programming_with_ranges/
>
> Andrei
>
>

If I understand it correctly "chunkBy" cannot accept a string lambda, due to the
template constraint. Therefore the line

   alias attr = unaryFun!attrFun;

seems unnecessary to me.

By the way, when I try the code from github, it only prints the first 3 months.
DMD32 D Compiler v2.063 (win7 64)



August 09, 2013
On Tue, 6 Aug 2013 12:56:48 -0700
Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> wrote:

> Vote up!
> 
> http://www.reddit.com/r/programming/comments/1jtzez/component_programming_with_ranges/
> 

Great article. Even as an experienced D user, it really gave me a lot to think about.