In addition to macro expansion Apparat has now inline expansion as well. It works nearly the same way as macro expansion but without most of its limitations. To define a class for inline usage it must extend apparat.inline.Inlined and all its methods must be static. However the cool thing is that you can also return values in contrast to macro expansion. You can also pass normal parameters. For instance FastMath.sin(FastMath.sqrt(2.0)) is valid code using inline expansion. It is enabled by default in TDSI.
inline expansion for apparat now available http://bit.ly/dBKkpK
Smart stuff – is there a ref of all apparat feats? RT @joa: inline expansion for apparat now available http://bit.ly/dBKkpK
Is there a reason to still use macro expansion or is inline expansion better in every way?
It is a different feature. But I would always go with inline expansion.
Well, actually it depends on what you want to do. Macro expansion can be very nice for bitwise operations. E.g.
BitMacro can define swap(x: int, y: int): void { x ^= y; y ^= x; x ^= y; } which would not be possible using inline expansion :)