What are the plans for `x.[1]`?

I think this came up a while ago but it’s a hard thing to search for.

Are there any plans in the language for x.[1] as an alias for getindex.(x, 1)?

1 Like

I know this isn’t exactly what you’re asking, but you can achieve something similar with UnderscoreOh.jl

julia> using UnderscoreOh

julia> v = [rand(2) for _ in 1:5]
5-element Vector{Vector{Float64}}:
 [0.6085133215181955, 0.6737658732824161]
 [0.7391928545794244, 0.8981975869418919]
 [0.4922990986854112, 0.6342074018581634]
 [0.6917310532402914, 0.6833501012445014]
 [0.6156112200856345, 0.9754178381164584]

julia> (_o[1]).(v)
5-element Vector{Float64}:
 0.6085133215181955
 0.7391928545794244
 0.4922990986854112
 0.6917310532402914
 0.6156112200856345

julia> (_o[2]).(v)
5-element Vector{Float64}:
 0.6737658732824161
 0.8981975869418919
 0.6342074018581634
 0.6833501012445014
 0.9754178381164584
1 Like

You might be thinking of this issue: https://github.com/JuliaLang/julia/issues/30845

2 Likes

Thanks! Indeed this is it. Looks like there are a lot of issues to work out with regards to that feature and a lot of thoughtful discussion around it.