Speculative: Disentangle getindex
and typed-array syntax
#53481
BioTurboNick
started this conversation in
RFC: features for discussion
Replies: 1 comment 1 reply
-
Almost a duplicate of #53241, except that was for |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
At first glance this is surprising - how is errantly indexing a Type trying to make a vector or do conversions?
It's happening because this is just the typed-array construction/concatenation syntax. And unfortunately, but cleverly, it overloads the
getindex
syntax and method to do this.It might be nice, in 2.0, to consider separating the
getindex
and typed-array syntax in some way.One available syntax could be braces (related: #8470):
Braces are universally now used in Julia to encompass type parameters, and the typed array syntax is effectively specifying a type parameter of the constructed array.
{T}[] => Vector{T}()
Beta Was this translation helpful? Give feedback.
All reactions