Escaping anonymous function in module attribute

We define the function where the value is in the AST, so captures “just work”. Given a value that may contain an anonymous function, this function returns new AST to reference a named function, and a quoted expression that will define those functions. The function name is derived from the option name and a hash of the code.

So to the rest of the code it looks like you’re always referencing &Module.fun/arity so it’s opaque.

EDIT: We also use a monotonically increasing number per module, which TBH may allow us not to bother with using the hash of the code, which would make for much prettier function names. I’ll look into it. Ultimately its all opaque to the user, except for that function name potentially appearing in stack traces (but with correct line numbers pointing to the anonymous function)