-
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
Parameterized impl syntax #1192
Comments
In discussions, we decided that we should also consider how we would name an impl declaration. This:
For unnamed impl declarations, we decided to go with option 3 using the
For named impl declarations, we decided to instead start with the
And when the impl was parameterized, use round parens
This allows us to name a specific method in the impl with bound values for parameters, so We decided to stop allowing bindings inside the "Type as Interface" part of the impl declaration, so they will always be after one of these new keywords. So
Alternatives considered:
|
@zygoloid and I talked through this a bit, and wanted to share where I think we're landing on the syntax question. We both are really happy with We both had sometimes overlapping, sometimes different concerns about other parts of this. None seemed huge, but enough that it seemed a bit difficult to get very comfortable moving forward. A concrete suggestion from me after the discussion:
One big question is -- would delaying the named impl stuff be OK? I feel bad as I brought them back into the discussion (sorry about that), but I feel like they're actually making it harder to move forward because they open a door to a larger space than necessary and than I intended. While I'm actually pretty optimistic about us wanting named If that is OK, are folks happy with this as the decision for now, and we'll leave named impls (and expanding the pattern spellings) to the future? |
I didn't include any of the specific concerns that came up in our discussion, and it is relevant that there were concerns. But to be clear, I don't think any of these are insurmountable. They may even be good things in the long run. The issue was whether we should eagerly spend more time right now figuring out the answers to those questions and resolving the remaining concerns. One concern comes down to what is Here is a very rough summary of my memory of the discussion... I may have missed some key points though (sorry for that), hopefully we can correct/iterate on any to capture things better.
This is roughly where I think we stopped. Not because any of this was concerning, it actually seemed fairly exciting to me at least. But it did seem to expose that there is more we should flesh out to understand what the mental model and design for named impls actually is. We could do that, but it wasn't clear this was a priority, and so it seemed like maybe worth just unwinding a bit and addressing the unnamed parameterized impls now, where we seem to be increasingly converging, and come back to named stuff later when we have more time to work through the details. Maybe this explains more the desire to narrow scope a bit? |
We said we needed the |
I'm fine splitting named impls out of this issue, since the original question for this issue was only about parameterized impls, as long as we copy the context. |
Let's call this specific issue decided with the comment above: #1192 (comment) And as @josh11b mentioned, keep recording any context or thoughts needed here so that when we pick up named impls again we don't have to rebuild that context. |
@jsiek observed in #executable-semantics on Discord (1, 2) that our current proposed array syntax creates an ambiguity in the grammar with the parameterized impl syntax:
@zygoloid listed some options for addressing this problem in the #syntax channel:
@chandlerc proposed in #generics that we might change our terminology to make the keyword
generic
applicable even when some of the parameters weretemplate
.The text was updated successfully, but these errors were encountered: