That's definitely an option, though it seems sub-optimal to me if it's 
possible to automate it from a user's perspective. It may be that it just 
isn't possible, but if so, is it because it's something the language 
doesn't currently support or does it go against the philosophy of the 
language?

Specifically, several possible methods could provide the necessary 
mechanism:

(1) Ability to get a function based on a signature and a namespace. Yes, 
you can get the names of functions in a namespace, but I don't see a way to 
convert that name to an actual function without an eval.

(2) Ability to create an call-expression with a namespace indicate to use 
the function from that namespace. For example: Expr(:call, :sym, 
:foobar_namespace, args). This means no additional lookup is required on 
the user's part.

(3) Allow macros to generate macros. This is already partially supported, 
though it's not clear if this is intentional or not. c++ has shown that 
template programming can be both useful and powerful (e.g. offloading 
computation to compile time rather than runtime).


All of these methods are general and not specific to the problem.


On Sunday, April 5, 2015 at 10:18:03 AM UTC-4, Toivo Henningsson wrote:
>
> If users should supply additional parsers (which parse sub-ASTs, right?) 
> then it's not really possible to hide all the metaprogramming machinery 
> from them anyway. So why not let the user create the macro, and just supply 
> functions that make writing the macro implementation as easy as possible?

Reply via email to