I'm going nucking futs trying to work out how to make this work, so I'm finally going to reach out here. I'm betting it's something really simple I'm just not getting.
I've got a macro working that is used like this:
properties do
...
end
The macro definition looks like:
defmacro properties(do: block) do...
But now I'd like to be able to put an optional keyword parameter in there:
properties id: :string, do # Alternatively, properties [id: :string], do
...
end
I can't seem to work out how to make that happen. I've tried a bunch of things
defmacro properties(options \\ [], [do: block]) do
defmacro properties(options) do # Expecting [id: string, do: block]
I've tried combining the above with "properties(id: :string) do" with "properties [id: :string], do" and "properties [id: :string] do" and just can't seem to hit on the correct syntax.
I expect this has to be possible, what combination have I missed that will make it work? :)
...Paul