Why the parenthesis around `(@main)`?

Since Julia’s most recent release (1.11) it seems the de-facto way to write a main (entrypoint function) is

function (@main)(args)
    println("hello world")
end

Why the parenthesis around @main?

Not that it matters, I’m just curious.

2 Likes

Because @main is not supposed to be applied to args, it just returns the main symbol as if you had written function main plus some behind the scenes bookkeeping

1 Like