Created
June 7, 2011 12:37
-
-
Save josevalim/1012150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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