Proposal: Partial Type Argument Inference
After exploring the concept in #23696, we've come to the conclusion that implicitly making type arguments available by name would unnecessarily expose previously unobservable implementation details. As such, I'll be breaking that proposal down into two parts. One is just the partial inference (which is here), which can stand on its own, as discussed in #20122 and #10571. To recap, partial type argument inference is the idea that some number of type arguments in a type argument list may be provided, while others are elided and fulfilled via inference using the rest. Specifically, in #10571 a number of different syntax proposals will brought forward: For the following examples, assume we have a ```ts declare foo<A,B,C>(): [A, B, C]; ``` # Variant 1 - elided entries ```ts foo<,,string>(); // returns [{}, {}, string] ``` This is the most terse option, as simply the lack of inputs implies inference sites. This would almost seem to logically follow from how not providing a list also causes inference to occur at all sites. This does have issues, however: specifying a final parameter as needing inference would require a trailing `,` in the list (something we currently explicitly disallow), and lists could very easily become confusing, as a `,` is very easy to skip over. # Variant 2 - Sigil marker ```ts foo<*, *, string>(); // returns [{}, {}, string] ``` As the second most terse option, this also has appeal; however I think it also fails on a few points. First, `*` is non-obviou
Posted by weswigham on Aug 6, 2018, 9:40 PM
Tags
Related issues
- The issue is really the extreme difficulty of programming them, especially for anything sequential (rather than combinatorial).
- I probably could have beared with it if it was only limited to programming, but it showing up in creative fields has made me feel all sor...
- I hate that I'm in deep enough to know what you mean.
- The biggest problem with “AI” is that big corps are shoving it down our throats.
- in the middel of a coding session with 5.6 sol.
- [Hero Run] 535B-A23B on 18T tokens
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
reliability (Other)
The issue is really the extreme difficulty of programming them, especially for anything sequential (rather than combinatorial).
I probably could have beared with it if it was only limited to programming, but it showing up in creative fields has made me feel all sor...
I hate that I'm in deep enough to know what you mean.
The biggest problem with “AI” is that big corps are shoving it down our throats.
in the middel of a coding session with 5.6 sol.
[Hero Run] 535B-A23B on 18T tokens
I hate that this is how AI is being used..
inexperienced protobuf user here -- why do non-googlers generally use protobuf?
Proposal: Partial Type Argument Inference
After exploring the concept in #23696, we've come to the conclusion that implicitly making type arguments available by name would unnecessarily expose previously unobservable implementation details. As such, I'll be breaking that proposal down into two parts. One is just the partial inference (which is here), which can stand on its own, as discussed in #20122 and #10571. To recap, partial type argument inference is the idea that some number of type arguments in a type argument list may be provided, while others are elided and fulfilled via inference using the rest. Specifically, in #10571 a number of different syntax proposals will brought forward: For the following examples, assume we have a ```ts declare foo<A,B,C>(): [A, B, C]; ``` # Variant 1 - elided entries ```ts foo<,,string>(); // returns [{}, {}, string] ``` This is the most terse option, as simply the lack of inputs implies inference sites. This would almost seem to logically follow from how not providing a list also causes inference to occur at all sites. This does have issues, however: specifying a final parameter as needing inference would require a trailing `,` in the list (something we currently explicitly disallow), and lists could very easily become confusing, as a `,` is very easy to skip over. # Variant 2 - Sigil marker ```ts foo<*, *, string>(); // returns [{}, {}, string] ``` As the second most terse option, this also has appeal; however I think it also fails on a few points. First, `*` is non-obviou
Comments (0)
No comments yet. Start the discussion.