-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Generic let
with auto
?
#996
Comments
Talking with @chandlerc , it seemed like
and
|
It seems like we're experimenting effectively with What do folks think about deferring the issue for now, or resolving it with that answer and letting it be re-opened if needed in the future? |
Talked with @josh11b about this, and it doesn't seem urgent to really settle/decide this. There is a rough approach in the current design and the best way to make more progress is to revisit when we have experience to reflect on with the choice. Moving this to the "deferred" bucket. |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the |
I believe #144, #2153, and #2360 answer these questions. The resolution of #2153 combined with the semantics of #2360 defines the type of types like I believe the resolution of questions is:
The last example:
looks like it would be allowed since |
Discussing with @zygoloid , the |
Would be good to capture somewhere the nuance of why and what the implications are of this... I find it both believable but also quite mysterious. |
The idea is that the ability to convert |
The I think it makes sense to use |
Continued from part 1: #3231. Second step updating `docs/design/generics/details.md`. There remains some work to incorporate proposal #2200. - The biggest changes are incorporating much of the text of proposals: - #2173 - #2687 - It incorporates changes from proposals: - #989 - #1178 - #2138 - #2200 - #2360 - #2964 - #3162 - It also updates the text to reflect the latest thinking from leads issues: - #996 - #2153 -- most notably deleting the section on `TypeId`. - Update to rule for prioritization blocks with mixed type structures from [discussion on 2023-07-18](https://docs.google.com/document/d/1gnJBTfY81fZYvI_QXjwKk1uQHYBNHGqRLI2BS_cYYNQ/edit?resourcekey=0-ql1Q1WvTcDvhycf8LbA9DQ#heading=h.7jxges9ojgy3) - Adds reference links to proposals, issues, and discussions relevant to the text. - Also tries to use more precise language when talking about implementations, to avoid confusing `impl` declaration and definitions with the `impls` operator used in `where` clauses, an issue brought up in - #2495 - #2483 --------- Co-authored-by: Richard Smith <[email protected]>
Proposal #950 defines generic
let
in a function body as a way to create an erased type.let T:! C = U
definesT
to beU
erased to have the API of the constraintC
. What is the behavior when the constraint is replaced withauto
?Simple case:
In this case, the
auto
should clearly meanT
, the type ofX
.What about these other cases where the type isn't as clear?
In particular, this last case came up in #950 since I wasn't sure how to give a name to a constraint expression. Could
C
be used in place ofMovable & Hashable
with the exact same meaning? What type doesauto
mean here? Does any erasing happen? I thought I might have to writelet template C:! auto = Movable & Hashable
to make something that didn't do any erasing, but I am not at all sure.The text was updated successfully, but these errors were encountered: