
On Jun 14, 2007, at 12:57 PM, Eric Niebler wrote:
Maurizio Vitale wrote:
if you could find a way to completely hide the fact that a terminal is a unary_expr from the user I think it would be much cleaner for a boost::proto release.
I'll give the issue some thought. One possibility is shoehorn into proto the concept of a nullary expression, which is what terminals should rightly be. Of course, what is there already works, so IMO there are bigger fish to fry first.
I think "usability" considerations play a big role in a library acceptance. In this case, for instance, if one's code is correct everything works fine: just have terminals first and the unary_expr pattern last. But when writing the code in the first instance, the patterns for terminals may be wrong . It is not so easy (at least for me) to find what's going wrong in a complex mesh of transforms when some other pattern matches unexpectedly. You just get the wrong result. With some luck this results in a type error somewhere else, but otherwise finding the problem in absence of a meta debugger is, mmm, challenging. Btw, for now I've wrapped my unary_expr pattern in the following way: proto::and_< proto::not_<proto::terminal<proto::_> >, proto::unary_expr<proto::_, proto::_> > so it is not terrible, but it might bite others in future. Best regards, Maurizio