Skip to content

Instantly share code, notes, and snippets.

@khia
Created October 11, 2012 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khia/3874237 to your computer and use it in GitHub Desktop.
Save khia/3874237 to your computer and use it in GitHub Desktop.
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