Hi, how can I invoke the default implementation of a callback of behaviour?
For example, if I want to override the GenServer
handle_info
callback, but only for some specific cases and keeping the default implementation for all other cases, what would be the proper way to do it?
Example code:
defmodule Foo do
use GenServer
def start_link(%State{} = state) do
GenServer.start_link(__MODULE__, state)
end
def init(state) do
{:ok, state}
end
def handle_info(:foo, state), do
IO.puts("received :foo")
{:noreply, state}
end
# NOTE: don't know how to do sth like this below.
# Needing sth like the `super` method in Python.
# def handle_info(msg, state), do: GenServer.handle_info(msg, state)
I am working with GenServer specially, but this is a question to all elixir behaviour in general.