Stories
Slash Boxes
Comments

SoylentNews is people

posted by martyb on Wednesday July 17 2019, @05:37PM   Printer-friendly
from the No!-Try-not.-Do,-or-do-not.-There-is-no-try.-YODA dept.

The Go language will not be adding a "try" keyword in the next major version, despite this being a major part of what was proposed for version 1.14.

Go, an open source language developed by Google, features static typing and native code compilation. It is around the 15th most popular language according to the Redmonk rankings.

Error handling in Go is currently based on using if statements to compare a returned error value to nil. If it is nil, no error occurred. This requires developers to write a lot of if statements.

"In general Go programs have too much code-checking errors and not enough code handling them," wrote Google principal engineer Russ Cox in an overview of the error-handling problem in Go.

A try statement was proposed to help reduce the coding burden. Upon further reflection:

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

[...] “Making an exit point of a function that isn't a return, and is meant to be commonplace, may lead to much less readable code,” said one user.

The outcome is a good one insofar as the Go community has proved able to make and withdraw a major proposal without rancour. And as for error handling, no doubt the team will, um, try again.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 5, Funny) by Rupert Pupnick on Wednesday July 17 2019, @05:55PM (3 children)

    by Rupert Pupnick (7277) on Wednesday July 17 2019, @05:55PM (#868120) Journal

    “Do or do not. There is no try.”

    Starting Score:    1  point
    Moderation   +3  
       Funny=3, Total=3
    Extra 'Funny' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   5  
  • (Score: 4, Informative) by maxwell demon on Wednesday July 17 2019, @06:24PM

    by maxwell demon (1608) on Wednesday July 17 2019, @06:24PM (#868134) Journal

    At the dept. line you look, there the joke already you find.

    --
    The Tao of math: The numbers you can count are not the real numbers.
  • (Score: 1, Redundant) by All Your Lawn Are Belong To Us on Wednesday July 17 2019, @07:55PM

    by All Your Lawn Are Belong To Us (6553) on Wednesday July 17 2019, @07:55PM (#868184) Journal

    Still funny, worth repeating it was!
    Rated 6 this should be. Laughing time for the Jedi also it is....

    --
    This sig for rent.
  • (Score: 2) by legont on Thursday July 18 2019, @03:47AM

    by legont (4179) on Thursday July 18 2019, @03:47AM (#868359)

    go to anywhere.

    --
    "Wealth is the relentless enemy of understanding" - John Kenneth Galbraith.