Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So you're ok with Python, which doesn't have sum types or null safety, 2 out of 3 things you say are missing in Go.

In fact, Python didn't have any compile-type type until recently and compared to Go is slow and bloated.

So maybe the issue is not Go's lacking some features but something entirely different.



class A: def __init__(): pass def f(self): pass

def g(a: A | None): a.f()

(edit: I don't know how to format code on HN)

If I activate type-checking in VS Code this will highlight an error, although the python interpreter will indeed try to run it without compile time error

As I said, for my side projects this is enough for me to model my problems properly without having to resort to multiple hacks

And I took Python as an example, I also enjoy using Ocaml and Rust


> I don't know how to format code on HN

two spaces: https://news.ycombinator.com/formatdoc


Python is dynamically typed, so everything is a sum type.


Mypy supports those for like 3-4 years already




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: