spec: document that x[i,]
(trailing comma) is permitted
#55007
Labels
Documentation
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
The spec does not seem to permit a comma after the index in an expression such as
a[i,]
, yet both the compiler and the go/parser package permit it, presumably because without type information it's impossible to distinguish an array index expressiona[i,]
from a parameterized type such asM[K,V,]
where a comma is permitted after the list of instantiating types. The spec should probably be updated to say that a comma is allowed but ignored. The alternative, of having the type checker allow the comma in a type but reject it in a term, would require recording the presence of the comma in the syntax tree, which seems undesirable.https://go.dev/play/p/JcES0elTHiG
The text was updated successfully, but these errors were encountered: