Just to quickly summarize an idea for further implementation on Fantom just for fun.
The idea is to enable multiple dispatch. Probably the same ideas can be further expanded to full-featured pattern matching.
- Everything will be implemented in a single dispatch.pod.
- There will be one class Dispatch with api like this:
Thus, anyone can construct a dispatcher like this:
- There also will be DSL plugin to enable Dispatch construction at compile-time (with proper error generation if possible) and facet @DispatchFunc, so the following code will be allowed (need to check whether current DSL API allows it):
- In method mode, by involving default param values, one more interesting feature can be enabled (synthetic example):