Re: [julia-users] Re: macros generating macros in modules

2015-04-05 Thread Abe Schneider
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?

Re: [julia-users] Re: macros generating macros in modules

2015-04-05 Thread Toivo Henningsson
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?

Re: [julia-users] Re: macros generating macros in modules

2015-04-05 Thread Abe Schneider
I think if I just copy bits of the current code in it might be the easiest. I have the following macro: macro grammar(name, definitions) parsers = [:+, :*, :?, :|, :-, :^, :list, :integer, :float] mapped_parsers = map_symbol_to_function(parsers) return parseGrammar(name, definitions,

[julia-users] Re: macros generating macros in modules

2015-04-04 Thread Abe Schneider
The issue I'm dealing with is that I have a macro that I want to pass a list of functions that the macro can employ for parsing grammars. The macro itself exists already, and it currently has its own static list of functions. I'm trying to figure out a way to allow the user of the library to

Re: [julia-users] Re: macros generating macros in modules

2015-04-04 Thread Abe Schneider
I don't understand how what I'm trying to do falls outside the domain of transforming code. My main goal is to take a user-defined grammar and create relevant code. More to the point, I think the general ability to generate expressions based on functions/namespaces is also solidly in the

Re: [julia-users] Re: macros generating macros in modules

2015-04-04 Thread Jameson Nash
I think the underlying issue may be that you are trying to have the macro do too much, when you should instead be just doing source-code transforms and preprocessing. One such example of a great use of a macro is simply: macro special_foo(syntax_tree) return quote special_foo(

Re: [julia-users] Re: macros generating macros in modules

2015-04-04 Thread Patrick O'Leary
Let me ask the question slightly differently. Without constraining yourself to legal Julia syntax, what would you like to go in, and what do you want to come out? I get the feeling there's a design here that doesn't have this complexity--my intuition is that a generic function can be used to

[julia-users] Re: macros generating macros in modules

2015-04-04 Thread Patrick O'Leary
On Saturday, April 4, 2015 at 9:04:10 AM UTC-5, Abe Schneider wrote: I should start off, not entirely sure this is an okay thing to do with Julia. Suppose I want to create a macro that generates another macro... I'm not sure whether this should work or not, but either way I'm not sure how