Some context to what @sgaure is saying:
-
the built-in syntax for functions in Julia is just syntax sugar for:
-
defining a new type, if it’s a new function
-
adding a method to the type making it callable
-
-
in Julia, any type can be callable, just add a method
-
in Julia, new types can be
structormutable struct(orabstract type, but obviously those don’t have instances, so they are not relevant here)
TBH I’m not completely sure what @sgaure’s point was either. I think they’re saying that some closures get lowered to a mutable struct, but I’m not sure if that’s true.