You should combine "__COUNTER___" with "before_after_##__LINE__" to make a unique identifier more robust.
Your snippet won't work with this inline example:
before_after("hello", "world") { before_after("hello", "world") { }}