partisan_otp_modules (partisan v6.3.0)
View SourceThe OTP-to-Partisan module correspondence: the single source of truth for which OTP modules Partisan substitutes, and how.
Every consumer derives its view from substitutions/0 rather than restating the
table:
partisan_otp_rewriterenames atoms, behaviour attributes and remote calls (atom_renames/0,call_renames/0).partisan_gen_transformgenerates one beam per OTP module (otp_modules/0,partisan_module/1).partisan_appandpartisan_otp_test_genload the generated set (partisan_modules/0).priv/generate_otp_sources.escriptwrites the generated set into themoduleskey ofpartisan.app.src.
Origins
A row's origin says how its Partisan module comes to exist, and that is exactly what decides which syntactic positions the rewrite renames:
generated—partisan_gen_transformderives the module mechanically from the OTP module's abstract code. Every such name is also a behaviour name, so it occurs as a bare atom in data (child specs,{via, Mod, Name}tuples, logger report labels) as well as in calls and-behaviourattributes. All positions are renamed.handwritten— Partisan ships its own module with a compatible API. Only remote calls are redirected. The atom keeps its OTP meaning in data positions, where renaming it would corrupt ordinary terms.
The two rename maps are therefore no longer independent tables that must be kept
consistent by hand: call_renames/0 is by construction a superset of
atom_renames/0.
Summary
Types
How a Partisan module comes to exist; see the module documentation.
One OTP-to-Partisan substitution.
Functions
Returns the renames applied to atoms in data positions, to -behaviour' attributes and to the-module' attribute.
Returns the renames applied to remote calls and remote fun references.
Returns the OTP modules `partisan_gen_transform' generates from, in generation order.
Returns the Partisan module that substitutes for OtpModule'. Errors with{badkey, OtpModule}' when the module has no substitution.
Returns the generated Partisan modules, in generation order.
Returns the substitution table, in generation order.
Types
Functions
Returns the renames applied to atoms in data positions, to -behaviour' attributes and to the-module' attribute.
Restricted to `generated' rows, whose names double as behaviour names.
Returns the renames applied to remote calls and remote fun references.
Covers every row: a handwritten substitute is reached by call even though its name must not be renamed as data.
-spec otp_modules() -> [module()].
Returns the OTP modules `partisan_gen_transform' generates from, in generation order.
Returns the Partisan module that substitutes for OtpModule'. Errors with{badkey, OtpModule}' when the module has no substitution.
-spec partisan_modules() -> [module()].
Returns the generated Partisan modules, in generation order.
This is the set `partisan_app' requires to be loadable at application start.
-spec substitutions() -> [substitution()].
Returns the substitution table, in generation order.
Order is significant: partisan_gen_transform generates the generated rows top
to bottom, and gen and proc_lib must exist before gen_server is generated.