Skip to content

Instantly share code, notes, and snippets.

@khia khia/gist:3874237
Created Oct 11, 2012

Embed
What would you like to do?
iex(6)> defmodule Test do
...(6)> defmacrop foo() do
...(6)> quote location: [line: 54], do: __ENV__.line
...(6)> end
...(6)> def test, do: foo
...(6)> end
iex:6: redefining module Test
{:module,Test,<<70,79,82,49,0,0,5,52,66,69,65,77,65,116,111,109,0,0,0,146,0,0,0,16,11,69,108,105,120,105,114,45,84,101,115,116,8,95,95,105,110,102,111,95,95,4,100,111,99,115,...>>,{:test,0}}
iex(7)> Test.test
10
iex(8)> __ENV__.line
8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.