Every ‘singleton’ struct can be constructed from it’s type using T.instance
julia> struct Foo end
julia> Foo.instance
Foo()
julia> typeof(sqrt).instance
sqrt (generic function with 19 methods)
julia> typeof(+).instance
+ (generic function with 206 methods)
I doubt this provides any great opportunities for optimizations though, and it’s generally not a good idea.
This sort
I think you should read that section again. The boxing problem only comes into play if you rebind the captured variable.