2023-07-26 –, 32-141
IsDef.jl provides maintainable type inference in that it
1. Uses code generation where possible to deterministically infer the types of your code
2. Allows you to overload type-inference with your custom implementation
3. If neither code generation works nor a custom type inference rule is given, it falls back to Core.Compiler.return_type, wrapped by some safety nets
In this talk IsDef.jl is presented, along with typical applications and details about the implementation.
I am super happy to announce the release of IsDef.jl. Since years I wanted to be able to check whether some function is defined for my types. Plain applicable
was not enough for me, because it just inspects the first layer, and if this is a generic function (like syntactic sugar), it won't give meaningful results. That was the motivation.
It turns out, you need full-fledged type-inference for this, however Julia's default type-inference is not intended for usage in packages. Inference is not guaranteed to be stable, may be indeterministic, and may change on any minor Julia version, which makes it really hard for maintainability. The purpose of Julia's default type-inference is just code-optimization and as such it is an implementation detail to Julia.
Hence, there is a need for another type inference system, or at least a layer around Julia's default inference which makes it maintainable. Welcome to IsDef
.
The highlevel interface of IsDef is very simple, consisting of two functions isdef
and Out
. The usage of these will be explained, along with implementation details and design decisions.
The package version is 0.1.x - suggestions, critics, and improvement ideas about the way inference is made maintainable are very welcome so that IsDef.jl can become the go-to package for maintainable type inference.
Stephan Sahm is founder of the Julia consultancy Jolin.io, and organizer of the Julia User Group Munich Meetup. In his academic days, he certified as Master of Applied Stochastics, Master and Bachelor of Cognitive Science, and Bachelor of Mathematics/Informatics. Since more than 5 years Stephan Sahm works as senior consultant for Data Science and Engineering, now bringing Julia to industry.
Stephan Sahm's top interest are in green computing, functional programming, probabilistic programming, real time analysis, big data, applied machine learning and in general industry applications of Julia.
Aside Julia and sustainable computing, he likes chatting about Philosophy of Mind, Ethics, Consciousness, Artificial Intelligence and other Cognitive Science topics.