More on "Component Programming"

Peter Alexander peter.alexander.au at gmail.com
Tue May 28 01:48:03 PDT 2013


On Tuesday, 28 May 2013 at 02:01:30 UTC, Andrei Alexandrescu 
wrote:
> I'm disappointed cartesianProduct works that way; I should have 
> caught that during the code review. A better iteration order 
> would have spanned the lower position in both ranges first, 
> i.e. create squares of increasing side in the 2D space.

Why is that better? It would be both unexpected and almost 
certainly slower.

It has the advantage that it works sensibly with infinite ranges, 
but I think the correct approach would be to provide a policy 
option for the iteration strategy (lexicographic, 
colexicographic, Gray, etc.) so that the user can control this.


More information about the Digitalmars-d mailing list