On Monday, December 29, 2014 9:27:41 PM UTC-5, Stefan Karpinski wrote:
>
> On Mon, Dec 29, 2014 at 9:07 PM, <[email protected] <javascript:>> wrote:
>
>>
>> I would really like if I could throw and catch an exception without
>> needing to consider that my program might panic as a result of doing so. I
>> just looked through the entire corpus of Julia code I have written so far,
>> and the only places I catch exceptions are when the exception is actually
>> due to calling a Python API via PyCall. I am willing to accept that using
>> exceptions is not a very Julian way of doing things, but I still want them
>> to work when they are needed.
>>
>
> "Panic" is the Go term for "throw". Your Julia program will not panic if
> you throw an exception – throw/catch works just fine.
>
Stefan, I misunderstood so thank you for the clarification.
Part of the reason I was inclined to think that exceptions are unsupported
is that I often see my code segfault if I create an exception e.g. by
pressing Ctrl+C. For instance, if I open the REPL, and type
julia> x = rand(4000,4000)
julia> x * x
and press Ctrl+C during execution, I nearly always get a segfault. In
Python I almost never see a segfault as an exception unwinds (and when I
do, I file a bug). But in Julia it seems to be the norm for me.
Somewhat related, I also experience intermittent segfaults on exit on a
cluster I use at UCSB unless I set OPENBLAS_NUM_THREADS=1. (I'd like to
get a stack trace on this and file a real bug, but I've been unable so far
to find where the core dumps disappear to even with sysadmin help, and the
problem goes away when I run julia under gdb).
And when I run the release-0.3 branch under valgrind (even something as
simple as the empty script `julia -e ""`), the results can be somewhat
scary (at least that is my interpretation).
Together these things imply to me that not enough effort/testing is being
put into ensuring that resources are cleaned up correctly as julia
terminates, but I'm curious if others have different takes on this.
I've been using Julia since September and overall I feel like I am hitting
real bugs at a much higher rate than a few per year (and can in that sense
relate to Dan's post). But for me Julia has made me so much more
productive that even dealing with these issues is more fun (and productive)
than my former days of using C++. As such, I'd really like to do what I
can to ensure overall trend is heading in the direction of increased
stability over time. I have a few ideas for things to do, but am curious
to know first what people think of my above assessment.