Gerar especificações de correspondência parametrizadas ETS a partir da definição de registro
-module(match_spec_from_record).-export([hooks_for_scope/2]).-record(hooks, { scope :: atom(), pid :: pid(), pre :: mfa(), post :: mfa() }).hooks_field_match_spec(1, _Scope, _Hook) -> hooks; hooks_field_match_spec(#hooks.scope, Scope, _Hook) -> Scope;hooks_field_match_spec(#hooks.post, _Scope, post) -> ‘$1’;hooks_field_match_spec(#hooks.pre, _Scope, pre) …
Continuar lendo