Sorry, just to confirm, which behavior is this you refer to here? I didn’t fully understand this.
The feature described on the docs page you linked to:
As of Julia, 1.11,
Base
exports the macro@main
. This macro expands to the symbolmain
, but at the conclusion of executing a script or expression,julia
will attempt to execute the functionMain.main(ARGS)
if such a function has been defined and this behavior was opted into by using the@main
macro.
You were asking what the difference between Main.main
and @main
is and I said, @main
resolves to Main.main
so in that sense they’re the same, but it also writes this hidden variable which is what enables the quoted behavior. If you just have a function called main
in your Main
module then nothing special happens if you run that script. But if you have a @main
somewhere then Julia will execute that function.