Google

A key proposal for Go 1.14 was rejected: adding a built-in try keyword

  The Go Gopher mascot of the Go language

Go is a popular language for native compiled applications

The Go language will not be adding a keyword "try" in the next major release, although it is an important part of what was proposed for version 1.14.

Go, an open source language developed by Google, presents static typography and compilation of native code. It is around the fifteenth most popular language according to the Redmonk classification.

Error handling in Go is currently based on the use of if statements to compare an error value returned to nil . If it is nil no error occurred. This requires developers to write many statements of if .

"In general, Go programs have too many code verification errors and do not have enough code to handle them," Google's chief engineer, Russ Cox, wrote in an overview of the problem handling error in Go.

Therefore, there was a proposal to add a built-in function try that allows you to delete many of the if statements and triggers a return of a function if an error is detected. The proposal was not for the complete handling of exceptions, which is already present in Go through functions panic and recovery .

That proposal has now been abandoned. Robert Griesemer, one of Go's original designers, announced the decision in a post yesterday.

Based on the overwhelming response of the community and the extensive discussion here, we are stating that this proposal was rejected earlier than planned. Regarding technical comments, this discussion has helpfully identified some of the important considerations we omitted, especially the implications for adding debug impressions and analyzing code coverage.

More importantly, we have clearly heard the many people who argued that this proposal was not focused on a worthwhile problem. We continue to believe that the handling of errors in Go is not perfect and can be significantly improved, but it is clear that as a community we must talk more about what specific aspects of error management are problems that we must address.

What was the problem? problem with try ? Opinions in the Go community are mixed, but what emerged was that many Go programmers did not care about the current approach and did not like to introduce a new built-in function that alters the flow of control.

"Create an exit point for a function that is not a return and that should be commonplace can lead to a much less readable code," said one user.

  Google, lightpoet's picture via Shutterstock

You can not say Go without Google – specifically, our little logo, Chocolate Factory insists

READ MORE

The result is good to the extent that the Go community has been able to make and withdraw an important proposal without rancor. And as for the handling of errors, without a doubt, the team will try again.

Sponsored:
Balance consumerization and corporate control.

For More Updates Check out Blog, Windows Softwares Drivers, Antivirus, Ms Office, Graphic Design Don’t Forget to Look Our Facebook Page Get Into Pc like us & follow on Twitter- @getinpc

Please Note: This content is provided and hosted by a 3rd party server. Sometimes these servers may include advertisements. igetintopc.com does not host or upload this material and is not responsible for the content.