Skip to main content
7 events
when toggle format what by license comment
Jul 5 at 3:16 comment added Alexander The 1st @jdm: I think the main reason you don't see this is that, for example with Java, Exception handling can get very verbose if you want to check for throwing either NullPointerException, or DivideByZeroException, or ArrayIndexOutOfBoundsException - the latter two of which could happen any time there's two numbers passed in, or a number dividing by an array length, or an array access. Hence why they are often Runtime Exceptions that can still happen, but can't be guaranteed to never happen.
Jun 12, 2021 at 10:33 comment added jdm Right, but what I suggested is a super-strict function where the compiler checks that null dereferences, unhandled exceptions etc. can never occur. (If you want to do more than simple calculations or call other super-strict functions, you could probably mark your code as safe manually.) Termination in case of a bug is exactly what I want to avoid. I'd like to catch these corner cases at compile time.
Jun 11, 2021 at 12:17 comment added rhellen The default in Vala is that no exceptions are thrown by a function. If a function has no throws ... clause, then it will never throw an exception. If any error does occur, whether it's a null dereference, an unhandled exception, or something else the program will be terminated.
Jun 10, 2021 at 16:36 comment added jdm I think this is not the same though. The compiler warns about ignored exceptions (errors). But there is not a way to say "dear compiler please make sure that this function cannot leak a NullPointerException". (I don't know if NPEs are even a thing in Vala, but that's just an example.)
Jun 10, 2021 at 13:19 history edited lennon310 CC BY-SA 4.0
deleted 68 characters in body
Jun 10, 2021 at 7:33 review First posts
Jun 10, 2021 at 13:19
Jun 10, 2021 at 7:31 history answered rhellen CC BY-SA 4.0