That’s a very fair ask. I will work up some code and it will be interesting to 
see how much they actually differ. 

I do think that the differences will be more apparent in the handling of errors 
during processing - eg Scan() - than during resource 
acquisition/initialization. 

> On Feb 21, 2021, at 8:52 PM, Ian Davis <m...@iandavis.com> wrote:
> 
> On Sun, 21 Feb 2021, at 5:23 PM, robert engels wrote:
>> Can someone please explain the benefit of ‘error return’ over ‘checked 
>> exceptions’ ? I have made the point a few times and it goes to crickets 
>> - I have to believe that is because there is none, or it is difficult 
>> to communicate.
>> 
> 
> I think since this is a Go list, the onus is on advocates of exceptions to 
> demonstrate the benefit of checked exceptions over error return values.
> 
> Here are a couple of scenarios that I encountered recently that had logical 
> linear flow with error returns. I'm curious how they would be improved with 
> checked exceptions:
> 
> 1) open three files for writing, closing the earlier ones if a subsequent one 
> fails to open
> 
> 2) open a file for append, falling back to creating a new writeable file if 
> the original is read-only or doesn't exist. The new file creation may also 
> fail due to disk errors or permissions.
> 
> I can envisage how to write them with exceptions but I'm struggling to see 
> where it would be more succinct or easier to read.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/9f3cf023-5bb4-49da-a842-0be97904d21a%40www.fastmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/D4D23F5D-E685-4873-BEA1-6F0179F0347D%40ix.netcom.com.

Reply via email to