On reflexion, I now think writing named tuples with square brackets might not be that crazy after all. All we have to do is recognize that the concept has nothing to do with tuples and everything to do with case class literals or records and stop shoehorning one concept into the other. So, assuming it’s not too late for redesigning named tuples : rename them as records, write them with square brackets and (as per Martin’s addition) use them as case class literals. Leave unnamed tuples alone whose pitfalls (no syntax for arity 0, 1 and clashes in general with parens notation used for expression delimitation) were never a problem until now. For one thing this would solve the question whether or not named tuples should be convertible to unnamed and in what direction. And we would get coherent syntax for data values, with repeated and optional parameters and everything:
val b1: BuildDescription = [
declarationMap = true,
esModuleInterop = true,
baseUrl = ".",
rootDir = "typescript",
declaration = true,
outDir = pubBundledOut,
deps = [junitInterface, commonsIo],
plugins = [
[ transform = "typescript-transform-paths" ],
[ transform = "typescript-transform-paths",
afterDeclarations = true
]
],
aliases = ["someValue", "some-value", "a value"],
moduleResolution = "node",
module = "CommonJS",
target = "ES2020"
]
What do you think?
Edit: and with records we could do away with pattern matching and avoid the ridiculous val (x = x, y = y) = ...
And: if this change is ever incorporated, at the same time would it be possible to de-experimentalize generic number literals so that Vector[BigInt] parses seamlessly for the mathematicians’ happiness.