4 ms·
I have imagine (for my toy language) that is weird to force one way or another (always handle or always check), but instead use the unix idea of STDOUT/STDERR.
by mamcx 12y ago
I have imagine (for my toy language) that is weird to force one way or another (always handle or always check), but instead use the unix idea of STDOUT/STDERR.
A function return values in STDOUT, and exceptions always go to STDERR:
This is GO style:
file | maybeError? := open('thisnotexist.ever')
And is totally ok to say, python style:
file := open('thisnotexist.ever')
and upper in the chain is possible to catch it:
match MyAwesomeFunction():
StdIn:
StdErr:
Or maybe
try/catch.
The idea is that if stderr is consumed is handled right there, but if not it "throw" and work like a exception.