## How It Works
## Example ```D import openmethods; mixin(registerMethods); interface Animal {} class Dog : Animal {} class Pitbull : Dog {} string kick(virtual!Animal); ```
## Example (cont'd) ```D @method string _kick(Dog dog) { return "bark"; } @method string _kick(Pitbull pitbull) { return next!kick(pitbull) ~ " and bite"; } void main() { updateMethods(); Animal hector = new Pitbull(); writeln("kick hector: ", kick(hector)); // bark and bite } ```
## registerMethods (CT) * scan module * string kick(virtual!Dog) * Method!("kick", "deallocator", string, virtual!Dog) * string dispatcher(Dog) { ... } -> kick * Method!(...) discriminator(MethodTag, Dog); -> kick * method info, this(), ~this()
## registerMethods (cont'd) * @method string _kick(Pitbull) * typeof(kick(MethodTag.init, Pitbull.init)) -> Method!(...) * spec info, this(), ~this()
## UpdateMethods (RT) * seed * scoop * layer * augment * checks * allocate slots * build dispatch tables
## Make a Call * fetch *obj -> vptr * fetch *vptr -> ClassInfo * fetch ClassInfo.deallocator -> mptr * fetch Method.slot -> slot * call (mptr[slot])