Subject: Re: [boost] Formal Review: Boost.RangeEx
From: Arno Schödl (aschoedl_at_[hidden])
Date: 2009-02-25 16:48:27
first of all thank you very much for RangeEx! It will replace a lot of code in our projects.
> So is everyone happy if I:
> 1. Change the 'ed' adaptors to _view
I liked the _ed, but have no strong opinion.
> 2. name the operator | alternatives with the same name as the adaptor?
At the risk of being late and redundant, I have a pretty strong dislike for overloading operator| or any other operator. I prefer the straight function syntax, with arguments in front so chains can at least be read from right to left, with the adaptors close to their arguments:
transformed( func, filtered( func2, uniqued( original_range ) ) )
The reason I don't like overloading is of fundamental nature. I don't see (unary) functions on ranges as vastly different from (unary) functions on anything else. It may also be nicer to write
3.41 | sqrt() | cos()| pow(3)
pow( cos( sqrt( 3.41 ) ), 3 )
but C++ has the latter syntax for function invocations, and I am not sure whether a library like RangeEx is the place to change this. I think so in particular because RangeEx IMHO is a real candidate for inclusion into the standard, where any non-standard syntax may be frowned upon.
The scope of streams, largely text processing, is arguably much narrower than that of ranges, so operator<< is easier to justify there, and the stream library is probably not the brightest spot of the STD library anyway.
Long chains were particularly necessary as long as you could not give names to intermediate results because of their obscure types. But with the auto keywork in C++0x, this problem will soon disappear, and with it the justification for super-long chains.
-- Dr. Arno Schoedl · aschoedl_at_[hidden] Technical Director think-cell Software GmbH · Invalidenstr. 34 · 10115 Berlin, Germany http://www.think-cell.com · phone +49-30-666473-10 · toll-free (US) +1-800-891-8091 Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl · Amtsgericht Charlottenburg, HRB 85229
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk