On Tue, Dec 15, 2015 at 3:30 PM, <[email protected]> wrote:
> I know I could pass the .+ operator to the macro, but then I wouldn't be
> able to type m1 + m2, I would have to type m1 .+ m2, which is not nice
> enough for me :)
IIRC you want `@your_macro +` to generate/refer to the `.+` function.
You can't just do `.$name` (or whatever the name is) since `.+` is a
symbol by itself (try `parse(".+")` and see yourself) and is not
really `.` plus `+`. The expression splicing also happens at ast level
and not at text level for (hopefully) obvious reason. So what you need
to do is to generate the `.+` symbol if `+` is passed in. How you
would do this depend on what generality you want, Assuming you will
only need this for operators that has a corresponding element wise
versing you can simply do in your macro
dname = symbol(".$name")
and splice this symbol (possibly with escape) when you need the .+ operator