Component programming with ranges

Ali Çehreli acehreli at yahoo.com
Tue Aug 6 22:16:19 PDT 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



More information about the Digitalmars-d-announce mailing list