(no title)
vbsteven | 4 years ago
I don’t know if there is a term for this concept. I’ve always seen it as some form of Dependency Injection/IoC but at the method level instead of object creation.
IIRC the Actix web framework in Rust does something similar for handler functions.
idiocratic|4 years ago
ptx|4 years ago
Test functions are never called explicitly and would otherwise (like unittest TestCase methods) never have any arguments, so in this context maybe it's clear that any arguments they do have must be magical.
simonw|4 years ago
EdwardDiego|4 years ago
The decorator pattern seems to fit, from my POV. The framework takes your code, creates a proxy that implements the interface, and then wraps your method in a method that does the stuff you asked for with the annotations before and after your method gets called.