
"Joel de Guzman" <joel@boost-consulting.com> wrote in message news:djhds4$vvv$1@sea.gmane.org...
I didn't run it but I think I understand what's going on. It simply encodes the recursive expression-type in the recursive variant. There's a significant flaw with this approach: all nodes must be known in advance. There is no possibility of user defined leaves; nor is there a possibility for having nodes that are from a different library;
I relized this when i was reading Spirit's documentation. I did mention from the begining all terminal leaf node types must be given, like in an MPL sequence (and probably for nonterminal node types if you can add more to the set). I did also mention this was in no way been generalized or a library of any form it was just an idea i had the other day. It's not true that there is "no possibility user-defined leaves" it is just not as simple as erasing type. I had some ideas to get around this, my initial thought was have a fallback on to type erasing you have a catch all type of the set of types in a variant that uses type erasing i don't like the idea but in this case there would probably be no choice. So yeah this does not gel so well with Spirit, maybe if boost::variant was like OCaml's polymorphic variants it would be a more feasible. Still though this could have it uses in other places where client wouldn't normally add new internal (nonterminal) nodes.