#til: Elixir has a `super()` function
2025-05-10
![]()
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 .
Was this useful?