-
-
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
Feature Request ".." operator to broadcast field access #32796
Comments
We currently allow I could have sworn we had an issue for this, but it looks like we just brought it up in the comments of #19169 (comment). |
Another idea is to have a clojure-ish synax |
What about overloading the "." operator and just use x.a |
Unfortunately, that's not possible because it's ambiguous if you're doing access on the array itself or its elements. julia> using Dates
julia> r = now():Day(1):now()+Day(2)
2019-08-06T12:58:14.878:1 day:2019-08-08T12:58:14.878
julia> r.start
2019-08-06T12:58:14.878
julia> r[1].instant
Dates.UTInstant{Millisecond}(63700779494878 milliseconds)
julia> map(x->x.instant, r)
3-element Array{Dates.UTInstant{Millisecond},1}:
Dates.UTInstant{Millisecond}(63700779494878 milliseconds)
Dates.UTInstant{Millisecond}(63700865894878 milliseconds)
Dates.UTInstant{Millisecond}(63700952294878 milliseconds) |
It also just violates the general principle of "don't conflate scalar operations with their vectorized forms" which is the mess we originally inherited from slower languages that need to do that. Let's not make that mistake all over again. |
With #24990 or similar, you could do |
For class MyClass.MyMember
And ArrayofMyClass = [ Instance1, Instance2 ... ]
Can we have:
ArrayofMyClass..MyMember = [ Instance1.MyMember, Instance2.MyMember ... ]
Combining the standard "." for object member and Julia "." for vectorising an operator.
The text was updated successfully, but these errors were encountered: