
In-Reply-To: <20050430145039.A20350@titan.hansons.demon.co.uk> ikh@hansons.demon.co.uk (Iain K. Hanson) wrote (abridged):
I really don't like macros.
I too have a strong antipathy to macros. I don't reject them absolutely, but they need a very good justification. I can't see myself ever using BOOST_FOREACH because the problem it is solving isn't hard enough to warrant the obfuscation. Comparing: BOOST_FOREACH( int i, vec ) cout << i; with: for (iterator i = vec.begin(); i != vec.end(); ++i) cout << *i; the macro just doesn't seem worth it. I find it scary. When I look at the implementation I am not reassured. This is replacing something I understand with something I frankly don't. I have looked at the documentation and found it a bit superficial. For example, I can't tell whether the example above is actually supported. All the examples in the documentation have braces around the loop body: are those just the author's preferred style, or are they required by the macro? I looked at the implementation and I still can't tell. I prefer to omit braces when they are not required. I have not tried to use the macro. From the source, it looks like it injects a largish number of local variables into the code, and these will show up in the debugger and need to be understood to follow how the loop is progressing. For what it's worth, I think the design is impressive and if I had come up with it I'd be very proud. Congratulations. The problem is that it is too clever. It is using a sledgehammer to crack a nut. I am not sure how one is supposed to vote in these circumstances - for a proposed library that one wouldn't use oneself. I don't necessarily want to prevent other people from using it if they want. I think it could help demonstrate both the usefulness of type inference and how yucky type inference is to achieve in C++ at present. It is an argument for language change. However, I guess it doesn't need to be part of Boost to do that. I vote against accepting BOOST_FOREACH into Boost. I hope the Review Manager pays more attention to my reasons than my vote. -- Dave Harris, Nottingham, UK.