
On Mon, Oct 18, 2010 at 4:41 AM, Matt Calabrese <rivorus@gmail.com> wrote:
I could change the way the macro works by making it one single macro invocation. That's probably the better solution even though it was something I originally wanted to avoid. Not having to put "end" is a good enough reason for me to change the design.
-- -Matt Calabrese
Sorry for the triple reply. Even though it's not a difficult change, I'm torn. My gripe with making it one macro is it implies extra surrounding parentheses and simply looks a bit more cluttered and confusing. That sounds like it's not a big deal, which it may not be, but it does at the very least make the original use-case more complicated. After all, the reason it was called "auto function" to begin with is because its original intent was to deduce the return type. If you separate the declaration from implementation, the return type isn't even deducible anymore, so it seems at least somewhat questionable to change the design to support such a feature. For instance template< typename T > BOOST_AUTO_FUNCTION( foo( T arg ) ) ( ( if is_integral< T > ) ( return arg + 1 )) as opposed to template< typename T > BOOST_AUTO_FUNCTION( foo( T arg ) ) ( if is_integral< T >) ( return arg + 1 ) The first one, at least to me, seems more complicated and less resembles a function. It's true that "break" is one more thing to know, but making the entire thing one macro invocation makes the original use-case -- automatically deduced return types -- more complicated. I could always just make a 2nd macro which puts everything into a single invocation without requiring "break" by just implementing it in terms of my current macro. Then I could expose them both and let users decide what they want. Either way, it should be easy to implement the changed design on top of the current design by wrapping, but not the other way around, so I think I'll just continue on as I am now and figure things out later. -- -Matt Calabrese