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



-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-talk/d90548c5-bb02-4417-877e-1c344bc462df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to