Stack pattern match


Imagine you have a reference implementation of a btree and a reference implementation of a locking manager and a security manager and you want to tie them together. You could add code calls from one to the other but what if there is a better way? The better way for extensibility is to match stack function calldepths to code snippets that run whenever the pattern is matched. For example when a btree is split you might want to acquire locks or release locks in a certain order. We can do pattern matching around the callsite of a btree split and return values and do the right locking and security behaviours without needing to change the API of either. Essentially you have parallel multiple return values.


I find it really painful merging clean implementations together.

If you have some code that works well and the hardest part is integrating it with some other piece of code without affecting the codebase too much

Callsite matching allows you to avoid changing either code base and write glue code between the interacting systems.

(別通知) (可選) 請,登錄