Hello All,

I find the following behavior a bit non-intuitive. IMHO, if addition of 
finally block changes the default behavior provided by the omitted catch 
block, we should force the user to declare a catch block.

# Version 0.4.0-dev+4160 (2015-04-06 03:40 UTC)  Commit 8fc5b4e* (1 day old 
master) x86_64-apple-darwin13.4.0

julia> function f1(x)
           try
               return x > 0 ? x/2 : error("x should be greater than zero")
           end # Let us assume user wants to ignore exception...
           println("returning normally without exception")
           -1
       end
f1 (generic function with 1 method)

julia> f1(1)
0.5

julia> f1(-1)
returning normally without exception
-1

julia> function f2(x)
           fp = open("/tmp/unrelated_resource.txt", "w")
           try
               return x > 0 ? x/2 : error("x should be greater than zero")
           finally
               close(fp) # only change is to close the file, no change 
intended for default on missing-catch-block
           end
           println("returning normally")
           -1
       end
f2 (generic function with 1 method)

julia> f2(1)
0.5

julia> f2(-1)
ERROR: x should be greater than zero
 in f2 at none:4

julia>

Thanks
--
Harry

Reply via email to