-
Notifications
You must be signed in to change notification settings - Fork 20
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
@set
with slices or broadcasting
#75
Comments
@set
with slices or broadcasting
Thanks a lot for reporting! Broadcasting is tricky and not supported right now. Though I agree it would be nice to have. The julia> @set s[2:3] += [100, 100] # slicing fails ungracefully
ERROR: StackOverflowError: is a bug I would say. The ideal approach to fixing it would be to fix the following in StaticArrays.jl: julia> Base.setindex(@SVector[1,2,3], [1,2], 1:2)
ERROR: StackOverflowError:
Stacktrace:
[1] setindex(a::SVector{3, Int64}, x::Vector{Int64}, inds::UnitRange{Int64}) (repeats 79984 times)
@ StaticArrays ~/.julia/packages/StaticArrays/6QFsp/src/deque.jl:198 and wait for this PR to land. |
I don't think this is necessary. Just fixing StaticArrays setindex should be enough - it's just called in Accessors as is: Accessors.jl/src/staticarrays.jl Line 3 in f0a65fe
|
Ah thanks you are right @aplavin |
Broadcasting is now supported ( |
You might have to be the one to open that |
Hello,
If I understand correctly, we may expect this to work out-of-the-box:
Regarding the first error, the macro expands to something containing
Accessors.:.+
. We probably need toesc
the operator symbol.+
so it gets evaluated toBase.Broadcast.BroadcastFunction(+)
, but I’m not sure if it’s that simple.The second error seems like it needs more urgent attention. If
s = [1, 2, 3]
is a normal vector,@set s[2:3] += [100, 100]
works fine, so it seems like this should be supported for static vectors.The text was updated successfully, but these errors were encountered: