Skip to content

Instantly share code, notes, and snippets.

@manpages
Last active December 28, 2015 18:09
Show Gist options
  • Save manpages/7540583 to your computer and use it in GitHub Desktop.
Save manpages/7540583 to your computer and use it in GitHub Desktop.
Nope.
➜ ~ cat nope.ex # we can, however, redefine +,- et al. Though it's not that useful:
defmodule Nope do
def left + right do
left <> " ZOMG " <> right
end
end
➜ ~ elixirc nope.ex
➜ ~ iex
➜ ~ ERL_LIBS=. iex
Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (0.11.1-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> import Nope
nil
iex(2)> "teh drama" + "rofl"
** (CompileError) iex:2: function +/2 imported from both Nope and Kernel, call is ambiguous
src/elixir_dispatch.erl:78: :elixir_dispatch.dispatch_import/5
lists.erl:1339: :lists.mapfoldl/3
src/elixir.erl:131: :elixir.eval_forms/3
iex(2)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment