Where is `===` actually defined?

In operators.jl one sees that ==(x, y) falls back to ===(x, y), but interestingly, ==='s definition in operators.jl is just…


I’ve never seen Julia syntax like it! :thinking:

On the repl, one gets:

julia> methods(===)
# built-in function; no methods

So where is === actually defined?
(And what are the cases in which the syntax on operators.jl is valid Julia code?)


It’s in Core and isn’t a generic function (you can’t change what it does)


The runtime version is called jl_egal, is defined in C and defines the semantics. Obviously there’s lots of optimizations for special cases in different parts of the compiler though.


Thank you! In which source file can the code for Core be found?

Thank you!

Searching for “jl_egal” in julia’s GitHub repo returns useful stuff, and it’s easy to spot the bit-wise comparison it performs (with memcmp).

How the low-level C function is associated with Julia’s === is the missing piece… perhaps that’s what’s in Core, whose source code I’m still to find.

All builtins are defined as c functions and most if not all are in builtins.c. You can find all the relevant code by searching for === in src/ and ignoreing all the ones in comments…