...
- fn is specified by an interface (IFn), taking/returning objects
- fns must still satisfy that interface
- How will callers know about primitive params/return, and how to invoke?
- New :static support
- can we decouple from static?
- Overloading
- we leverage in Java root ops (e.g. Numbers) but don't expose
- even? as an example of something that would have to be primitivized in order to be efficient with all arg types
:static
- defn supports {:static true} metadata
- :static fns can take/return longs and doubles in addition to Objects
- compiler will compile static methods in addition to IFn virtual methods
- When compiling direct invocation of :static fn, compiler will look at var metadata and make call to static method
- Note that because it is not going through the var at runtime, will not see any dynamic modifications to the var
- thus 'static'
- Caller won't see redefs, bindings etc
- Like macros, recompile client code to see changes
- Note that because it is not going through the var at runtime, will not see any dynamic modifications to the var
- The var still contains IFn object for HOFs etc
- and you can get dynamic call by using (#'foo ...)
...