Skip to content

Development

Bartosz Błaszków edited this page Jun 24, 2025 · 1 revision

Development

How to patch functions of OTP modules

  1. Add module to patches/... if it doesn't exist yet.
  2. Add a new implementation. In case of private function:
    • In Elixir you should make it public (otherwise it might get pruned) and add @compile {:popcorn_patch_private, name: arity} before the definition.
    • In Erlang you should add -compile({popcorn_patch_private, name/arity}). (near the top of the file, before function definitions). Without exporting it, the linter will complain, but that can be ignored.
  3. To successfully compile the file:
    • Replace local calls (foo(...)) with :popcorn_module.foo(...) (or popcorn_module:foo(...) in Erlang)
    • Copy or replace any module attributes, missing types and struct definitions (in Erlang)
  4. Comment each introduced change with Patch reason: explaining why the change has been introduced.

Clone this wiki locally