Closed wangl-cc closed 1 year ago
Docs for implicit names from identifiers in NamedTuple
and keyword arguments: https://docs.julialang.org/en/v1/base/base/#Core.NamedTuple,
https://docs.julialang.org/en/v1/manual/functions/#Keyword-Arguments.
When a bare identifier or dot expression occurs after a semicolon, the keyword argument name is implied by the identifier or field name. For example
plot(x, y; width)
is equivalent toplot(x, y; width=width)
andplot(x, y; options.width)
is equivalent toplot(x, y; width=options.width)
.
I have also found leading semicolon will break name tuple construction without implicit names from identifiers:
nt = (; a = 1, b = 2)
Playground:
identifier [0, 0] - [0, 2]
ERROR [0, 3] - [0, 21]
parameter_list [0, 5] - [0, 21]
keyword_parameters [0, 6] - [0, 20]
optional_parameter [0, 8] - [0, 13]
identifier [0, 8] - [0, 9]
integer_literal [0, 12] - [0, 13]
optional_parameter [0, 15] - [0, 20]
identifier [0, 15] - [0, 16]
integer_literal [0, 19] - [0, 20]
I'm using tree-sitter with nvim, and I found there are some error when parse code with semicolon.
Construction:
Playground:
Destruction:
Playground:
Keyword arguments:
Playground