3 ms·
Actually, Julia functions are all subtypes of Function. Every julia function has a unique type. We don't parameterize a function by it's input and return types
by eigenspace 5y ago
Actually, Julia functions are all subtypes of Function. Every julia function has a unique type.
We don't parameterize a function by it's input and return types because functions are extremely polymorphic in julia. However, there's lots of tricks one can do to dispatch on whether or not a given function have methods that satisfy some sort of interface, see here: https://github.com/oxinabox/Tricks.jl#we-can-use-static_hasmethod-to-declare-traits https://github.com/oxinabox/Tricks.jl#we-can-use-static_hasm...
Using this technique, you can do compile time dispatch on things like input and return types.
- saiojd 5y agoFunctions are polymorphic in many languages that let you annotate the their types. The concern is not really for dispatch here, it's for readability/correctness.
- eigenspace 5y ago> The concern is not really for dispatch here, it's for readability/correctness. Then dispatch to an error.