Macro __CALLER__ q

33 views
Skip to first unread message

Alex Shneyderman

unread,
Feb 27, 2015, 6:19:43 PM2/27/15
to elixir-l...@googlegroups.com
I have a macro that I needs to recognize  __CALLER__ vars.

so when I do - 

   def idle(%{"timeout" => t} = state) do
      ereceive do 
        ....
      end
   end

erceive is the macro and it needs to know state and not t. So when I do __CALLER__.vars I am getting [state: nil, t: nil]. There is  no information on the exact nature of state or t. Is there a simple way to differentiate between the arguments without overwriting def ?

Cheers,
Alex.

Eric Meadows-Jönsson

unread,
Feb 27, 2015, 7:42:36 PM2/27/15
to elixir-l...@googlegroups.com

How would you like to differentiate the variables? Can you explain a bit more what the ereceive macro does and how it wants to use the variables?

Would it be possible to pass the variables the macro needs to it? Like this: ereceive state do ... end.


--
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-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/d74c492b-e4bd-48e8-adb0-4fe9a95a5d76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Eric Meadows-Jönsson
Reply all
Reply to author
Forward
0 new messages