Skip to content

Instantly share code, notes, and snippets.

@josevalim
Created June 7, 2011 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save josevalim/1012150 to your computer and use it in GitHub Desktop.
Save josevalim/1012150 to your computer and use it in GitHub Desktop.
module Introspection
% This method is generated automatically by
% Elixir and is exhibited here as an example.
% def __module_name__
% 'Introspection
% end
def original_inspect
inspect
end
def my_inspect
self.inspect
end
def original_name
% This is a local call to the method generated above.
__module_name__
end
def my_name
% This is a remote call to __module_name__ in the current self.
self.__module_name__
end
end
module Main
mixin Introspection
end
Main.my_name % => 'Main
Main.original_name % => 'Introspection
Main.my_inspect % => "Main"
Main.original_inspect % => "Main"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment