-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FS-1006 struct tuples #30
base: main
Are you sure you want to change the base?
Conversation
@T-Gro Any change we can get a review. |
@@ -355,6 +365,9 @@ example, `typeof<int * int>` is equivalent to `typeof<System.Tuple<int,int>>`, a | |||
runtime type `System.Tuple<int,int>`. Likewise, `(1,2,3,4,5,6,7,8,9)` has the runtime type | |||
`Tuple<int,int,int,int,int,int,int,Tuple<int,int>>`. | |||
|
|||
Tuple types and expressions that have `S` resolved to struct tuple are translated in the same way to `System.StructTuple`. | |||
|
|||
|
|||
> Note: The above encoding is invertible and the substitution of types for type variables | |||
preserves this inversion. This means, among other things, that the F# reflection library | |||
can correctly report tuple types based on runtime System.Type values. The inversion is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can correctly report tuple types based on runtime System.Type values. The inversion is | |
can correctly report tuple types based on runtime System.Type and System.ValueTuple values. The inversion is |
@@ -355,6 +365,9 @@ example, `typeof<int * int>` is equivalent to `typeof<System.Tuple<int,int>>`, a | |||
runtime type `System.Tuple<int,int>`. Likewise, `(1,2,3,4,5,6,7,8,9)` has the runtime type | |||
`Tuple<int,int,int,int,int,int,int,Tuple<int,int>>`. | |||
|
|||
Tuple types and expressions that have `S` resolved to struct tuple are translated in the same way to `System.StructTuple`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tuple types and expressions that have `S` resolved to struct tuple are translated in the same way to `System.StructTuple`. | |
Tuple types and expressions that have `S` resolved to struct tuple are translated in the same way to [System.ValueTuple](https://learn.microsoft.com/dotnet/api/system.valuetuple) . |
|
||
A _struct tuple expression_ is checked in the same way as a _tuple expression_, but the pseudo-type `S` is resolved to struct tuple. | ||
|
||
Tuple types and expressions that have `S` resolved to reference tuple are translated into applications of a family of F# library types named |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tuple types and expressions that have `S` resolved to reference tuple are translated into applications of a family of F# library types named | |
Tuple types and expressions that have `S` resolved to reference tuple are translated into applications of a family of .NET types named |
A _struct tuple expression_ is checked in the same way as a _tuple expression_, but the pseudo-type `S` is resolved to struct tuple. | ||
|
||
Tuple types and expressions that have `S` resolved to reference tuple are translated into applications of a family of F# library types named | ||
`System.Tuple`. Tuple types `ty1 * ... * tyn` are translated as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`System.Tuple`. Tuple types `ty1 * ... * tyn` are translated as follows: | |
[System.Tuple](https://learn.microsoft.com/dotnet/api/system.tuple). Tuple types `ty1 * ... * tyn` are translated as follows: |
struct ( ty 1 * ... * tyn ) | ||
``` | ||
|
||
The elaborated form of a tuple type is shorthand for a use of the family of F# library types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The elaborated form of a tuple type is shorthand for a use of the family of F# library types | |
The elaborated form of a tuple type is shorthand for a use of the family of .NET types |
``` | ||
|
||
The elaborated form of a tuple type is shorthand for a use of the family of F# library types | ||
`System.StructTuple<_, ..., _>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`System.StructTuple<_, ..., _>`. | |
[System.ValueTuple](https://learn.microsoft.com/dotnet/api/system.valuetuple). |
|
||
When considered as static types, tuple types are distinct from their encoded form. However, the | ||
encoded form of tuple types is visible in the F# type system through runtime types. For example, | ||
`typeof<int * int>` is equivalent to `typeof<System.StructTuple<int,int>>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`typeof<int * int>` is equivalent to `typeof<System.StructTuple<int,int>>`. | |
`typeof<int * int>` is equivalent to `typeof<System.ValueTuple<int,int>>`. |
Added "struct tuples" according to FS-1006 to the types, expressions, patterns and inference chapters.