-
-
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
smarter BoundsError reporting #9534
Conversation
this adds argument information to intrinsic bounds checking operations, optimized to have a no added impact on the runtime cost in the common case of not having an error
Wow, this is a really incredible start for the new year! This is a major improvement IMHO. One small suggestion: maybe to make the error even more explicit, say
|
💯 |
+1 for the wording suggested by @nalimilan, I find it more explicit and easy to understand. |
+1 for explicit and readable, cool! On Thu, Jan 1, 2015 at 8:16 AM, Daniel Høegh [email protected]
|
<3 this. |
+10000 This can only be beaten by package precompilation Jameson ;-) |
We should all get together and buy Jameson his own tropical island for Christmas (as long as it has really good WiFi). |
@joehuchette, the printing could be tackled by anyone, that's something that doesn't need Jameson's wizard skills. Care to take a crack yourself? See the implementation of |
Yes the printing needs to be fixed. There is no point in showing syntax-style |
I see Also given that the help string is help?> getfield
Base.getfield(value, name::Symbol) Why is a non-symbol name even allowed? IMHO, it is super confusing right now if for the following error is raised julia> getfield([1], 1)
ERROR: BoundsError: attempt to access 1-element Array{Int64,1}:
1
at index [1] Which looks like (just from the error) julia raise a error on Edit: Ok. I see that number index is used to access field in a composite type. Nevertheless, the error message above is still confusing. It's probably better to change the doc string of |
since
|
Maybe adding a flag to indicate the context? (getindex/getfield, maybe also another one for iterator?) |
Just wondering: wouldn't it be better to print the index first, and the array after? When arrays are long, the index is hard to find. For example (from #9607):
vs. something like
What do you think? |
When the underlying array is 100x100x2500, the index (if it comes first) will disappear from the console's history. But in any event we probably want to switch to printing a summary when the array gets large. |
I don't see how printing out the value is useful. The Type of the value, it's size / length and the out-of-bounds index requested should be all you need. |
BoundsError() made me sad (so I fixed it)
this adds argument information to intrinsic bounds checking operations, optimized to have no added impact on the runtime cost, in the common case of not having an error
lots of examples (because there's a lot of cases this handles):
ref #9520
ref #6297
ref #7978
ref #4744