LL
Size: a a a
LL
AB
AB
V
V
LL
erlang
— самый настоящий ООП в понимании одного-единственного человека (Алана Кея)V
V
erlang
— самый настоящий ООП в понимании одного-единственного человека (Алана Кея)РП
В
defmodule Foo do
@before_compile Baz.FooManager
@some_bar [10, 11]
def call_some_bar, do: @some_bar
end
defmodule Baz.Foomanager do
defmacro __before_compile___(env) do
value = Module.get_attribute(env.module, :some_bar)
Module.put_attribute(env.module, :some_bar, [9 | value])
end
end
iex> Foo.call_some_bar
#=> [10, 11]
ŹR
defmodule Foo do
@before_compile Baz.FooManager
@some_bar [10, 11]
def call_some_bar, do: @some_bar
end
defmodule Baz.Foomanager do
defmacro __before_compile___(env) do
value = Module.get_attribute(env.module, :some_bar)
Module.put_attribute(env.module, :some_bar, [9 | value])
end
end
iex> Foo.call_some_bar
#=> [10, 11]
В
defmodule Baz.Foomanager do
defmacro __before_compile___(env) do
value = Module.get_attribute(env.module, :some_bar)
Module.put_attribute(env.module, :some_bar, [9 | value])
some_calling = quote do
def call_some_bar, do: @some_bar
end
Module.eval_quoted(env.module, some_calling)
end
ŹR
ŹR
В
ŹR
defmodule Foo do
@before_compile Baz.FooManager
@some_bar [10, 11]
def call_some_bar, do: @some_bar
end
defmodule Baz.Foomanager do
defmacro __before_compile___(env) do
value = Module.get_attribute(env.module, :some_bar)
Module.put_attribute(env.module, :some_bar, [9 | value])
end
end
iex> Foo.call_some_bar
#=> [10, 11]
РП