I believe you can replace injecting the code with this:
defp foo(%{very: "specific", match: "clause"} = args, acc) do
# implementation... then call the "shared" functions
foo(args, acc)
end
defp foo(args, acc) do
CommonValidations.foo(args, acc)
end
Then CommonValidations.foo gets to be a proper function instead of an injected one, with all the benefits of better error messaging.






















