-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
Consider an expression like v[p.(v)] .*= 2
where p
is a predicate (i.e. returns a boolean). Currently Julia's semantics are that p.(v)
is constructed and then used to index into v
. However, the optimal implementation of this would to loop through v
, testing each element x in v
to see if p(x)
is true and then multiplying it by 2 if that's the case. While it might be possible for a compiler to optimize the current semantics to this behavior in some circumstances, arguably, the dotted application of p
in the indexing expression should participate in dot fusion of the whole expression, and this expression should simply mean the optimal implementation. Marking as 1.0 since if we're going to change the semantics of this expression, we should do so before then.