Skip to content

Commit 4d4fb5f

Browse files
committed
Add another note about the contextual keyword syntax alternative.
1 parent 1054c86 commit 4d4fb5f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

vision-documents/variadic-generics.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ This design for variadic generics results introduces 2 new meanings of `...`, le
384384
3. Type parameter pack declaration
385385
4. Pack expansion operator
386386

387-
Choosing an alternative syntax may alleviate ambiguities with existing meanings of ... in Swift. The authors of this vision document are open to considering an alternative syntax, but have yet to find a more compelling one.
387+
Choosing an alternative syntax may alleviate ambiguities with existing meanings of `...` in Swift. The authors of this vision document are open to considering an alternative syntax, but have yet to find a more compelling one.
388388

389389
### Pack and unpack keywords
390390

@@ -400,6 +400,7 @@ The downsides to choosing a keyword syntax are:
400400

401401
* A keyword with a parenthesized operand in expression context is subtle because it looks like a function call rather than a built in expansion operation.
402402
* A new keyword in expression context would break existing code that uses that keyword name, e.g. as the name of a function.
403+
* A contextual keyword must be resolved in the parser, meaning there is no room for moving resolution of the unpack/expansion operation to later in type checking, e.g. to support member packs. The `unpack` keyword would need to instead be a special built-in function or method at the expression level, and a keyword at the type level.
403404

404405
### Alternative postfix operators
405406

0 commit comments

Comments
 (0)