Skip to content

Instantly share code, notes, and snippets.

@bcardarella
Created August 10, 2025 14:44
Show Gist options
  • Save bcardarella/abdc12389feb71649f77b111c89ecec1 to your computer and use it in GitHub Desktop.
Save bcardarella/abdc12389feb71649f77b111c89ecec1 to your computer and use it in GitHub Desktop.

The reason why I don't want to stash the ast from the parent module and inject that quoted form into the child is because of private functions

If a function definition requires calling a private function, I could override Kernel.defp and stash/inject into the inheriting module but if any of the parents in the inheritance chain implement a similarly named private function they would confilct. Private functions aren't intended to be implemented, just the public ones.

If I was really ambitious I could do a static analysis of the quoted form to determine if any function calls are made to fucntions that are not availble in the stashed local scope. If it cannot find then it will write a function delegate to the parent module's public definition. This would mean that any functions that fall under this situation cannot call a private function of they would cause a compiler error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment