-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Raise informative error for exponentiation to negative power (see #3024) #8784
Conversation
Is there any chance the message could be made even more explicit? Less skilled users are the ones which are going to find this behavior unexpected, and for them I think the message you added is quite difficult to understand. Technically, would it be possible to print something like |
This doesn't have access to the values themselves, and of course if it was a function with But I agree with the overall concern. Would
be an improvement? |
Yeah, I was suspecting that. Your new proposal looks like an improvement to me, but maybe it would be even better to mention somewhere the fact that writing
|
Seems like a fine suggestion to me. I'll let this sit a bit and see if anyone else chimes in with further suggestions. |
Why couldn't this go in the error itself, similar |
Can't remember for sure, but I think it has to do with GC frames and/or inlining. |
Yeah, that's really unfortunate, as explicit errors everywhere make a language much nicer to user, especially for newcomers (and they are the ones that make your user base grow...). |
It may be possible at some point to read values straight from the stack instead of forcing them to be heap-allocated, which would allow access to values without a performance hit. |
Adopted @nalimilan's suggested wording. I will be away for a couple days; if this turns green and anyone is in a hurry, just hit merge. Or just wait until I get back. Also, I only belatedly noticed that this (and the similar handling of other |
Raise informative error for exponentiation to negative power (see #3024)
For some reason I don't see this even in the REPL on OS X. I just get the normal old DomainError: julia> 2^-10
ERROR: DomainError
in power_by_squaring at /Users/stefan/projects/julia/usr/lib/julia/sys.dylib
in ^ at intfuncs.jl:104
in process_options at ./client.jl:221
in _start at ./client.jl:362
in _start at /Users/stefan/projects/julia/usr/lib/julia/sys.dylib |
The decoded bt cames back as
So I tried with f05660e and it seems to work. Any reason @timholy didn't attach this to the |
@ivarne I think he's going to be offline for a few days. Edit: nevermind, on Linux where Tim presumably tested this, his version works and yours doesn't. Some platform-dependent inlining or something going on? |
I noticed, but you happened to have a reasonable guess also 😄, and he will be back . |
Sorry for my compulsive post-editing, if you haven't hit refresh. Your method works on Mac, Tim's method works on Linux. Dunno why it's different. Check for either case and issue the same message? |
Maybe there's another email I haven't yet gotten to about a fix for this, but this looks like it's not due to a difference in dispatch, it's due to a difference in backtraces. Someone on a Mac will probably have to fix & test. (Preferably, someone with access to both Mac & Linux.) |
I suppose we could just do |
Backported for both Linux and Mac in 201c916 |
No description provided.