-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Named tuples second implementation (#19174)
This implementation follows the alternative representation scheme, where a named tuple type is represented as a pair of two tuples: one for the names, the other for the values. Compare with #19075, where named tupes were regular types, with special element types that combine name and value. In both cases, we use an opaque type alias so that named tuples are represented at runtime by just their values - the names are forgotten. The new implementation has some advantages - we can control in the type that named and unnamed elements are not mixed, - no element types are leaked to user code, - non-sensical operations such as concatenating a named and an unnamed tuple are statically excluded, - it's generally easier to enforce well-formedness constraints on the type level. The main disadvantage compared to #19075 is that there is a certain amount of duplication in types and methods between `Tuple` and `NamedTuple`. On the other hand, we can make sure by this that no non-sensical tuple operations are accidentally applied to named tuples.
- Loading branch information
Showing
61 changed files
with
2,365 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.