Extending builtin functions like ifelse()

Apparently, it’s currently impossible to extend builtin functions. Is there an effort to change this? Or is there a way around the restriction already?

The issue came up in a feature request for NumberIntervals.jl.

No it doesn’t make much sense to allow that.

What makes sense is to change it to a normal function with a default implementation using a builtin function if overloading is desired.

For ifelse, it’s pretty much an eager ?: and should probably be implemented like that.

2 Likes

That’s ok, I’m really only interested in extending ifelse() for a three-value logic usecase. Should I open an issue for that in the Julia github?

You can open one about removing the ifelse builtin and replacing it with a branch if you want.

For reference make `ifelse` generic · Issue #32844 · JuliaLang/julia · GitHub