
Larry Evans wrote:
The file, expk_test.zip here:
http://www.boost-consulting.com/vault/index.php?&directory=Strings%20-%20Text%20Processing
Contains a prototype where tags contain the arity. This prototype enables initialization like: <===== cut here =======
using namespace boost::proto;
typedef tags::tag_kind_arity<tags::tag2<tags::tag2_shift_right>,tags::tag_valu,2> tag_shift_right_2;
What's that?
expk<tag_shift_right_2,args2<int,int> > shift_right_int_int={1,2};
Why? What is there works very well and nobody is complaining about it.
I tried to figure out if putting arity in tags would prevent some specialization on arity which proto currently uses to do it's work. I guessed that maybe this specialization was used in or_ or and_;
Just about every part of Proto is specialized on expression arity. See the file iteration in deep_copy.hpp for an example.
however, when I looked in matches.hpp, all I found (that was relevant, AFAICT) was: <snip> and I couldn't figure out how it works. I would have guessed there would be some specialization on the bool B template parameter, but apparently not.
Eric, could you mention the code where specialization on arity is used and how it works. I might could figure it out eventually, but I'm guessing others, in the future, might like to understand this also, and this information, documented somewhere in an implementation or design guide, would be *real* handy.
Of course, I realize you're in the middle of analyzing all the proto reviews, but eventually, getting this information about how it works would be quite helpful.
I probably won't ever document Proto's internal implementation details, sorry. Use the source. Preprocess it first, if it makes it easier. -- Eric Niebler Boost Consulting www.boost-consulting.com