#til: Elixir has a `super()` function

#til: Elixir has a super() function

Elixir's Kernel.defoverridable/1 lets you mark functions (or callbacks from a behaviour) as overridable, enabling modules that use or import the original to redefine those functions. In an overriding function, calling super(args) invokes the original implementation defined before defoverridable, letting you wrap or extend its behaviour. This approach supports patterns such as fallback logic or mix‑in style behaviour, while preserving original functionality via super() calls .

Visit Original Article β†’