No error handling for Go
Compiling the following program to Go produces no error handling logic:
import sys
print(int(sys.argv[1]))
package main
import (
"strconv"
"os"
"fmt"
)
func main() {
_int, _ := strconv.Atoi(os.Args[1]) // error handling missing
fmt.Println(_int)
}
When we go run foo.go "not_an_int", the program prints 0 and exists successfully. When we python3 foo.py "not_an_int", we see:
Traceback (most recent call last):
File "foo.py", line 3, in <module>
print(int(sys.argv[1]))
ValueError: invalid literal for int() with base 10: 'not_an_int'
That's right, a middleware that implements Go-style error checks was in the works, however currently that's not implemented.
As a whole this projects is currently on hold: I am currently focused on my job and different projects. I'll probably finish a more stable new version if there is any interest in it. (The people interested in this project had vastly different usecases/wishes for its functionality so I decided to wait for a compelling usecase)
Fair enough. I'm certainly interested in this project. I'm contributing to Grumpy (a Python runtime in Go) which aims to support most of Python2.7 in all its dynamic glory, but it does so by compiling everything into a Go *Object struct. Ideally, I would like a hybrid approach, which compiles to idiomatic Go whenever provably possible, falling back to dynamic *Objects when not. This is well outside the scope of this project and probably not feasible, but I'm sure I can learn a lot toward that end by following this project.
That's a very nice idea, but you're right, it's outside the scope of this project. Grumpy is pretty interesting, I wonder if somebody is building a Ruby runtime on Go too.