-
-
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
splatting in tuple construction #4869
Comments
Interesting timing; what's probably the same issue came up just today in JuliaIO/HDF5.jl#55. Similarly to your last example:
|
This is a very, very old "feature" which makes |
I'm all for changing this. Where are we even using this at this point? |
There are a very small number of uses in the inference and promotion code. Of course we'd need a new syntax for the current meaning; one thing that works now is |
Yup, that seems just fine. |
I started looking for all the uses of this, and one place this syntax is nice is inside argument lists, for example
I wonder if that should be a special case. |
I remember suggesting to use postfix
etc? I hope that we wouldn't have to make a special case for this. I'm glad that this issue has been lifted because I've been bothered about the current special case. |
That's a very good idea; I think it might be workable. |
I do like that idea. |
+1 |
1 similar comment
+1 |
I ran into this today. :P I'd love to see the prefix/postfix separation. +1 |
|
I agree that @JeffBezanson's proposal looks more natural. |
So in the proposed syntax |
I like the look of |
Despite the nice analogy between |
It could become more important in the future, e.g. with function types @mbauman good point that |
Actually the syntax for UnionAll types could be |
Using parens in |
Yes, I suppose it conflicts with the ability to "call" a tuple type. This currently works:
Going back to function types briefly, if we really want I guess we could have |
We could also use |
The downside is that it wouldn't fit with writing |
I don't get that bit – can you elaborate? |
You want to be able to do
so that there can be a single variable that represents all of the arguments. You want to be able to pull out any subexpression into a variable. Of course it's possible to have
but I think pretty suboptimal. |
How does this fit with the discussion over in #6984 where |
fixed by #10380 |
I was surprised to discover that this doesn't work:
I was expecting
(3,4,5,6)
, but gottype: apply_type: in Vararg, expected Type{T<:Top}, got (Int64,Int64)
Even more surprising,
works, but outputs
(3,4,()...)
instead of(3,4)
, with(3,4,()...)[3]
being a somewhat mysterious()...
object of typeDataType
.I understand that some special magic has to occur here in order to be able to define tuple types like
(Int, Bool, Float64...)
, but the behavior above seems odd.The text was updated successfully, but these errors were encountered: