Does it matter where in the code a function is defined?


#1

The documentation for “Metaprogramming” says “Calling any function that is defined after the body of the generated function … should not be attempted.” I can’t find any other mention of whether it matters where in the code a function is first defined (e.g. before vs. after it is first called). Are there any other situations where this matters at all? Presumably the function needs to be defined either in the namespace in which it’s called or in an imported module - are there any other restrictions?


#2

Well, don’t call something before it’s defined but no, nothing other than this should matter. The order and namespace the function is defined in does not matter as long as they are within scope/accessible.


#3

Sorry, in retrospect this was a really stupid question.