@@ -443,25 +443,20 @@ end
443
443
# ###########################################################
444
444
445
445
# x[...] .= f.(y...) ---> broadcast!(f, dotview(x, ...), y...).
446
- # The dotview function defaults to view , but we override it in
446
+ # The dotview function defaults to getindex , but we override it in
447
447
# a few cases to get the expected in-place behavior without affecting
448
448
# explicit calls to view. (All of this can go away if slices
449
449
# are changed to generate views by default.)
450
450
451
- dotview (args... ) = view (args... )
451
+ dotview (args... ) = getindex (args... )
452
+ dotview (A:: AbstractArray , args... ) = view (A, args... )
452
453
# avoid splatting penalty in common cases:
453
454
for nargs = 0 : 5
454
455
args = Symbol[Symbol (" x" ,i) for i = 1 : nargs]
455
- eval (Expr (:(= ), Expr (:call , :dotview , args... ), Expr (:call , :view , args... )))
456
+ eval (Expr (:(= ), Expr (:call , :dotview , args... ),
457
+ Expr (:call , :getindex , args... )))
458
+ eval (Expr (:(= ), Expr (:call , :dotview , :(A:: AbstractArray ), args... ),
459
+ Expr (:call , :view , :A , args... )))
456
460
end
457
461
458
- # for a[i...] .= ... where a is an array-of-arrays, just pass a[i...] directly
459
- # to broadcast!
460
- dotview {T<:AbstractArray,N,I<:Integer} (a:: AbstractArray{T,N} , i:: Vararg{I,N} ) =
461
- a[i... ]
462
-
463
- # dict[k] .= ... should work if dict[k] is an array
464
- dotview (a:: Associative , k) = a[k]
465
- dotview (a:: Associative , k1, k2, ks... ) = a[tuple (k1,k2,ks... )]
466
-
467
462
end # module
0 commit comments