I think this is the same feature discussed recently by the Symbolics and Julia compiler teams. I would be interested to see what the experts have to say on this topic.
For each of many external abstract types T , I want to make a new abstract subtype of T whose dispatch users control.
For example, a const LazyInteger = Lazy{Integer} that’s a subtype of Integer but has custom lazy method implementations.
I can implement this for certain types manually, but I don’t think it’s currently possible to represent the idea of customized subtypes of types like
abstract type Lazy{T} <: T end
What applications does this feature enable? What are the problems with it? What are the alternatives?
Indeed, as mentioned in a big Zulip thread, I just talked with Jeff and Keno today and our plan is to use SymbolicTracing as the approach, and try and find ways to make the macro act nicely on full functions, modules, and within the REPL so that you can get this behavior without invading the compiler.