D component programming is a joke (Was: Re: Component programming)
Justin Whear
justin at economicmodeling.com
Fri Aug 2 09:06:46 PDT 2013
On Thu, 01 Aug 2013 22:24:32 -0700, H. S. Teoh wrote:
> Now, w.r.t. the roadblocks I alluded to.
>
> When I first started working on the code, my goal was to maximize usage
> of existing Phobos facilities in order to show how many batteries D
> already comes with. As it turned out, I could only use basic Phobos
> components; some of the more complex pieces like frontTransversal, which
> would've been perfect for the bit that splices formatted month lines
> together, couldn't be used because it wasn't flexible enough to handle
> the insertion of fillers when some subranges are empty. In the end, I
> had to code that range by hand, and I can't say I'm that happy with it
> yet.
I recently wrote a range component for my current project that is similar
but with a twist. It takes a bunch of ranges, each of which is assumed
to be sorted with some predicate, then it walks through them, returning a
range of the fronts of each range. The twist is that it has to call a
user-supplied `produce` function whenever it encounters a mismatch (e.g.
a range's front is greater than the others or a range is empty).
More information about the Digitalmars-d
mailing list