-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
strange error for deprecated scalar-fill indexed assignment #29266
Comments
It also seems that the |
I'm wondering what is the status of this problem. We also encountered this problem. Definitely, it is a good idea to include more explanation about indexing ans assignment. Many people want to do something like:
Of course, if I replace the scalar
It would be really nice if this scalar assignment works as before in Julia v0.6.x and 0.7. |
You are supposed to use |
@fredrikekre ; thank you very much for your clarification! |
I agree that a better error message would be helpful here. I imagine this will be a common novice mistake. Suggesting broadcast operators would give the user a cue. |
I've just hit this problem while migrating a part of my code from Julia 0.6 to 1.0 (for now, 1.0.1), and it took me a few hours to track it down. A better error message would be much welcome! I would be willing to propose a PR for this, but I have no idea how you could implement it… |
That'd be great @dourouc05! I think it might be a simple as defining julia> @eval Base setindex_shape_check(::Any...) = throw(ArgumentError("nice string"))
setindex_shape_check (generic function with 7 methods)
julia> a = fill(1, 10);
julia> a[1:5] = 0
ERROR: ArgumentError: better message Make the message better, test more cases, add those cases as tests, and you'll be on your way! |
With the deprecation removed, attempting
a[idxs] = scalar
gives an unclear error:The text was updated successfully, but these errors were encountered: