|
Boost : |
From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-03-07 06:05:44
Paul Moore wrote:
> Call me a heretic, if you must, but I wouldn't even
> contemplate the "new
> way" you show above in preference to the "old way". I don't
> find the "new
> way" any more readable. (OK, I need to read the docs to be
> sure of the order
> of parameters with the "old way", but that's nothing new...)
You are not just "need to read the docs", you need to read them every time
you use 'iterator_adaptor', and every time you use yet other similar (in
number of parameters) template from some other library, and maintenance
programmers will need to read them too (or every time look at the template
declarations), and you need to do it even when you know that all these
classes do, because there might be a lot such classes and one can not
possibly remember their long parameters lists and all default values. And if
you provide the arguments in a wrong order the compiler won't necessary
inform you about it, even if the library is very good and uses the concept
checking all through the code. And if the default parameters are not so
simple and depend on the mandatory ones in some not-so-trivial way (as, I
believe, it is with the 'iterator_adaptor' class template), you will end up
writing much more verbose, and, that's more important, much less
maintainable code than the one that was written using the NTP technique.
> Don't lose the "old way" for the sake of the "new one".
I believe it was never the intent, at least not mine. Having done something
like this before, I think there is a simple way to support both usage
patterns without much cost for the library users.
Aleksey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk