[talk] try() in golang

Edward Capriolo edlinuxguru at gmail.com
Mon Jul 8 18:16:52 EDT 2019


On Monday, July 8, 2019, Sujit K M <kmsujit at gmail.com> wrote:

>
>
> On Mon, Jul 8, 2019 at 8:12 PM Edward Capriolo <edlinuxguru at gmail.com>
> wrote:
>
>>
>>
>> On Mon, Jul 8, 2019 at 10:14 AM Brian Coca <briancoca+nycbug at gmail.com>
>> wrote:
>>
>>> "try not, do or do not, there is no try!"
>>>
>>> It is kind of a poor man's exception handler.
>>>
>>> They should either really add exception handling or stick with the
>>> 'if' err', 1/2 measures like that will end up with worst of both
>>> worlds.
>>>
>>>
>>> -------------
>>> Brian Coca
>>>
>>> _______________________________________________
>>> talk mailing list
>>> talk at lists.nycbug.org
>>> http://lists.nycbug.org:8080/mailman/listinfo/talk
>>
>>
>> Agree. I do not find it useful without catch or finally. The fact that
>> they have to propose such a minimal try and get no traction seems on par
>> with common google style. Some of the comments about nested try being
>> unreadable are obvious. You typically do not nest try even in languages
>> where you can.
>>
>>
> Found some thing interesting why Go avoids Exceptions. It is the way they
> think I guess.
> https://dave.cheney.net/2012/01/18/why-go-gets-exceptions-right
>

 You can’t throw an exception inside a method without annotating that
method’s signature to indicate you may do so, and you can’t call a method
that may throw an exception without wrapping it in code to handle the
potential exception. Via the magic of compile time bondage and discipline
the error problem is solved, right?

Wrong. There are checked and unchecked exceptions in java. You DONT have to
annotate the method if the exception is an unchecked exception.

Author spends way to much time wrongfully explaining how other languages
work and I got tired of reading before the go part.

Moral of the story , they were able to add good and try catch to perl. But
go folks cant get it done.


-- 
Sorry this was sent from mobile. Will do less grammar and spell check than
usual.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nycbug.org:8080/pipermail/talk/attachments/20190708/8cf7967d/attachment.html>


More information about the talk mailing list