There is a feature in Julia that has enabled us to do some magical things. It is all thanks to this:
julia> adder(f, a) = ()-> f() + a
adder (generic function with 1 method)
julia> f = ()->5
#3 (generic function with 1 method)
julia> g = adder(f, 1)
#1 (generic function with 1 method)
julia> h = adder(f, 2)
#1 (generic function with 1 method)
julia> typeof(g) == typeof(h)
true
The fact that g and h are the same type has enabled us to do some truly magical things. Our code basically takes in some user input parameters as numbers, processes them a bit with arithmetic/math operations, and then passes those resulting numbers to a CPU/GPU kernel that simulates charged particles. The kernel will be JIT compiled of course based on the types of the resulting numbers. One feature I added was the ability to make the user input numbers actually be functions of time, which are then evaluated inside of the kernel itself per-particle. A special type wrapping an anonymous function was created, and arithmetic operations overloaded so it acts like a number - this is for the processing step. Then we pass the resulting function to the kernel, which is JIT compiled for said anonymous function. Thanks to this above feature, the kernel only needs to be JIT-compiled once, not every time it is called with the same user input (the processing step with overloaded arithmetic operators does not create new anonymous function types each time). It is really amazing, and we tested it and it works with CUDA etc.
As such, I just wanted to verify that this feature above is considered a stable part of the language?