3 ms·
One feature I've wanted is an error return keyword to complement 'return val;' something like 'error_return val;' Then a feature where if a function does an err
by Gibbon1 6y ago
One feature I've wanted is an error return keyword to complement 'return val;' something like 'error_return val;' Then a feature where if a function does an error return but the caller doesn't check the error the compiler inserts a exception or a panic.
So you could write code like
log_stuff(stuff); // on an error will panic.
var rtn = log_stuff(stuff);
if(rtn.error)
{
// handle error
}
try
{
log_stuff(stuff);
}
catch()
{
// jumps here on an error
}