Another syntactic consideration is whether to allow bare keywords as identifiers after ::
, just as we do after .
. E.g.
MyModule::switch = true
thing.MyModule::as(.that)
My opinion is YES because there's no ambiguity here.
But I think allowing whitespaces after ::
can cause confusions in parser. E.g.
Foo::
switch bar {
...
}
This Foo::
is probably an incomplete expression, or mistyped Foo:
(statement label). But allowing whitespaces after ::
would eat Foo::\nswitch
as an expression, and the diagnostics will be confusing ("consecutive statements must be separated by ;
" between switch
and bar
)
edit:
I thought it might be worth mentioning that .
actually allows whitespaces before the member name, but only when it's balanced:
foo .
bar() // OK
But I consider this a bug, though it’s probably too late to change now. That said, I don't think we need to follow it.