I am replying to your questions in this post:
Point - 1) Anonymous functions, captured functions, etc - covered in previous post. & operator creates anonymous functions in cases 3, 4 like expanding short form anonymous functions defined using &() or &{} or & and partially applying functions - As you are modifying second parameter of the Test.test function using Map.get - it will create an anonymous function (see example capture_5) .
Point - 3) True
validates()
macro is expanded before __before_compile__
, but it appears lexically in the bottom of the file (till here - was in that sense). Anonymous function assignment to a module attribute directly or indirectly does not cause error. Module attributes are available only during compile time - any usage of module attribute with anonymous function in a func/macro will cause compiler error - in this case __before_compile__
is causing error.
Have a nice weekend.