New syntax suggestion: catch with type specs

Actually I was thinking of heading in the opposite direction. Essentially, all that I’m doing is allowing one to create methods for an anonymous function. I was wondering it if would be better to be more explicitly like the following instead of doing “magic”.

try
catch e
    error_handler = @anon_method begin
        e::AssertionError -> println("AssertionError")
        e::InexactError -> println("InexactError")
    end
    error_handler(e)
end
2 Likes