News for hackers. Stuff that matters.
Re:On the uses and misuses of panics in Go by cpeterso on Thursday August 09, 2018 @05:53PM (#17728888)
The Icon programming language has a nice error handling style that reminds me of Go's local error handling but with less boilerplate. Functions can return success/failure along with the actual return value, like an implicit Maybe/Option type.

Converting the article's example code from Go:

  f, err := os.Open("file.txt")
  if err != nil {
    // handle error here
  }
to pseudo-Icon:

  if f := os.Open("file.txt") then
    read(f)
  else
    handle error here
https://en.wikipedia.org/wiki/Icon_(programming_language)
Re:On the uses and misuses of panics in Go by scns on Friday August 10, 2018 @03:48AM (#17731422)
iirc it works like that in swift:

if let file = os.Open(file) { do sth } else { handle error }