Skip to content
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

Merged
merged 2 commits into from
Dec 17, 2013

Conversation

porterjamesj
Copy link
Contributor

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.

@JeffBezanson
Copy link
Member

Yes, this is exactly how to do it. Too easy, I'd say :)

@porterjamesj
Copy link
Contributor Author

Yeah I was amazed how simple it was. Props to all of you for having such a comprehensible codebase :)

@porterjamesj
Copy link
Contributor Author

Thoughts on the nested tuples thing?

@lindahua
Copy link
Contributor

This is great. An immediate use of this is to write arrays of fixed size.

@JeffBezanson
Copy link
Member

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.

@ivarne
Copy link
Member

ivarne commented Dec 16, 2013

Merge conflicts is impossible to avoid when everybody is appending tests to the end of the same test/core.jl file.

@porterjamesj
Copy link
Contributor Author

I'll rebase, one sec.

@porterjamesj
Copy link
Contributor Author

OK should be good to merge.

@pao
Copy link
Member

pao commented Dec 16, 2013

Types section of the manual needs an update, too.

Both abstract and concrete types can be paramaterized by other types and by certain other values (currently integers and symbols).

...and possibly other places.

Indicating that bools and tuples are allowable.
@StefanKarpinski
Copy link
Member

Not allowing nested tuples seems silly to me.

JeffBezanson added a commit that referenced this pull request Dec 17, 2013
RFC: Allow tuples as type parameters.
@JeffBezanson JeffBezanson merged commit f28ddaa into JuliaLang:master Dec 17, 2013
@porterjamesj porterjamesj deleted the tuptypes branch December 17, 2013 06:46
@quinnj quinnj mentioned this pull request Dec 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants