-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
RFC: Allow tuples as type parameters. #5164
Conversation
Yes, this is exactly how to do it. Too easy, I'd say :) |
Yeah I was amazed how simple it was. Props to all of you for having such a comprehensible codebase :) |
Thoughts on the nested tuples thing? |
This is great. An immediate use of this is to write arrays of fixed size. |
I think this is totally fine; the only possible worry is that it invites generating very large numbers of types, but I'll just have to trust everybody. Unfortunately I just caused a merge conflict. Sorry about that. |
Merge conflicts is impossible to avoid when everybody is appending tests to the end of the same |
I'll rebase, one sec. |
OK should be good to merge. |
Types section of the manual needs an update, too.
...and possibly other places. |
Indicating that bools and tuples are allowable.
Not allowing nested tuples seems silly to me. |
RFC: Allow tuples as type parameters.
I decided to try and hack #5102 myself; this is what I came up with. Everything seems to work fine; all the tests pass and I added a quick one for this. I am not at all familiar with the internals so its entirely probable that I missed something, @JeffBezanson should certainly take a look. Also let me know if my style is out of line.
NB: since I made
valid_type_param
recursive, things like(1,(2,3))
become valid type params. If we only want flat tuples I can change this.