Include argument labels in identifiers

I know I’m late to the discussion, but I’m also confused. What’s being proposed here?
Is it repealing SE-111 and bringing back argument labels to closures, is it adding syntactic sugar to turn this: var foo: (a: Int) -> () into this: var foo(a:): (Int) -> () or is it something else?

Something else: SE-111 removed argument labels from type signatures. This proposal is for adding them to identifiers.

It’s not syntactic sugar, since it isn’t just shorthand for something else.

5 Likes

It's for allowing this:

var foo(a:): (Int) -> Void = { /* ... */ }

foo(a: 42)
1 Like

Has there been any movement on this? If there's nothing in the works already, I'd be interested in taking a stab at a prototype implementation for allowing argument labels in variable names.

8 Likes

Bump. Also very curious if this is really not a problem for the community that there is lack of named arguments for closures?

I wrote up a mostly-complete pitch for this here, and (speaking for myself only) I don't really expect that this would be a particularly controversial change. There are some lingering design questions to settle I think, and a prototype implementation would need to be prepared to bring this to being a full proposal.

I wasn't able to land an implementation back when I initially worked on it, but I fully support someone else picking up this effort. Otherwise, this is on my list of things to pursue whenever I have some free time to dedicate to landing a proposal. :slightly_smiling_face:

6 Likes