Expronicon.jl
Expronicon.jl copied to clipboard
Collective tools for metaprogramming on Julia Expr
fixes #17
This is a corner case but it can come up when you're generating code from a language that's end not Julia, such as GraphQL and a field is called "end"....
``` julia> JLFunction(;name="foo", kwargs=[JLKwField(;name=:arg1, default=10)])^C julia> kw = JLKwField(;name=:arg1, default=10, type=:Int) arg1::Int julia> f = JLFunction(;name="foo", kwargs=[kw]) function "foo"(; arg1::Int) end julia> codegen_ast(a) :(arg1::Int) julia> codegen_ast(f) :(function ("foo")(; arg1::Int) end)...
currently I manually write if else in ExproniconLite to get rid of MLStyle/MatchCore, but this is not necessary since the generated code from `@match/@switch` is actually dependency free. In principle...
As you have time, or some inspiration, additional examples and different kinds of use would go a long way to getting people more comfortable with this.
``` "foo" bar ``` Was failing
```julia julia> :("foo") "foo" julia> bar = 42 42 julia> :("foo $bar") :("foo $(bar)") julia> dump(ans) Expr head: Symbol string args: Array{Any}((2,)) 1: String "foo " 2: Symbol bar julia>...