Why is the expression `@foo.x` parsed as `macrocall . foo @x` and not `macrocall @foo .x`?

Because whitespace is important in Julia. @foo.x and foo.@x are the same thing (a macro call with 0 arguments) whereas @foo .x is a macro call with 1 argument, the same as @foo(.x).

.x is a valid expression to the parser, it is used for relative imports like using .Foo.

3 Likes