Live data from Hacker News

Things from Python I'd miss in Go

yosefk.com

21–30 of 142 posts

Re: Things from Python I'd miss in Go

#21
post #10

As for the GUI problem mentioned in the article, we now have https://github.com/andlabs/ui I haven't yet tried this lib, It may not as good as something as Qt, but I think it is a good beginning.

first thing it mentions in the readme: this package is very much incomplete

Re: Things from Python I'd miss in Go

#22
post #19

Earlier quoted context omitted.

That creates some mostly unnecessary boilerplate. I.e., if an error happens down the stack in function to read config, which calls a function to parse a file, which calls a function to read a file, you'll have to either propagate (or otherwise handle) that `err` manually or lose the precious information. On the contrary, Java-like pattern of functions like `Config readConfig() throws IOError, ParseError` simplifies c…

The readConfig example is not really an issue in go. Just return the io error and type switch after the readConfig. if config, err := readConfig(ioReader); err != nil { switch err.(type) { case io.ErrClosedPipe: // do one thing case ParseError: // do something else case ... } }

> Just return the io error

Manually, on every function call that may fail - that was my only point why exceptions may result in a clearer code.

    section, err := parseSection(ioReader)
    if err != nil { return nil, err }
Has some boilerplate, as compared to a typical exception-based

    section = parseSection(reader)  // throws IOError

Re: Things from Python I'd miss in Go

#23
post #9

In the beginning i missed repl, but i've realised using repl in the first place was a mistake.. Now i rely on docs(godoc is awesome) and when i need to test something i use go playground.

Could you elaborate on why using the repl was a mistake? I don't really miss python's repl, but coming from the Lisp repl, the playground doesn't seem to cut it. Now, if anyone has written an emacs mode that lets you interact with the playground by loading a buffer- I think I'd be much happier.

Re: Things from Python I'd miss in Go

#24
post #10

As for the GUI problem mentioned in the article, we now have https://github.com/andlabs/ui I haven't yet tried this lib, It may not as good as something as Qt, but I think it is a good beginning.

I played around with it, it is nowhere near Qt, not even like 5% close. Qt isn't just a GUI library, it's everything you need to build a application in a nice large bundle. But it's a nice start...

However I feel that Go is not really intended to be used for desktop applications, I would much rather see a Rust GUI library.

Re: Things from Python I'd miss in Go

#25
post #3

Towards the end of the article there seems to be a confusion between servers and web servers. Yes, Go is nice for writing servers, no, web servers aren't the only things out there doing 'serving' in systems-land. Three examples from CloudFlare all written in Go: 1. Our Internet compression/optimization technology called Railgun 2. Our DNS server 3. Our CA infrastructure All are networked, all are highly concurrent. A…

Is the Lua stuff going away? What are your opinions of Go vs Lua?

Re: Things from Python I'd miss in Go

#26
post #5

The error handling one is an area I've never understood - in a well-designed Go app errors will be returned from functions/methods and you'll either deal with them or not _/err. I love try/catch/finally but I fail to see how doing either a _ or writing a simple log function to do something with returned errors necessarily represents "more code" than handling exceptions.

That creates some mostly unnecessary boilerplate. I.e., if an error happens down the stack in function to read config, which calls a function to parse a file, which calls a function to read a file, you'll have to either propagate (or otherwise handle) that `err` manually or lose the precious information. On the contrary, Java-like pattern of functions like `Config readConfig() throws IOError, ParseError` simplifies c…

I don't consider error handling to be unnecessary, but it is boilerplate, no matter how or where it's implemented. That's because every non-trivial program has the potential to enter an error state. That state can either be ignored (deliberately or not, the latter case being a major source of most of the angst and misconceptions around C and C++) if the language allows it or handled in some way, and that way is by boilerplate "if/else" or "try/catch".

Re: Things from Python I'd miss in Go

#28
Most of the GUIs are done on a main thread which makes some of Go's advantages unneeded. Don't build GUI in Go, ever.

Error handling is a way of thinking: TDD is one, Go's approach is another.

REPL is not a must, environment without REPL means you have to think more about what you want. It's a process. You should be able to read source code and figure out how things work.

Like many mentioned here, Go is great at doing system stuff, like background queues and processing. Stay with Python until you need to get thing faster, then move them to Go. That's how you should think of it.

Re: Things from Python I'd miss in Go

#29
post #3

Towards the end of the article there seems to be a confusion between servers and web servers. Yes, Go is nice for writing servers, no, web servers aren't the only things out there doing 'serving' in systems-land. Three examples from CloudFlare all written in Go: 1. Our Internet compression/optimization technology called Railgun 2. Our DNS server 3. Our CA infrastructure All are networked, all are highly concurrent. A…

It looks like the author found the worst use case for Go in comparison to a library that Python absolutely soars in and uses that as a basis for this argument. Go does not have something as nice as numpy. For numeric computing, by all means use Python.

He then makes some crazy statements about operator overloading as if that is the essence of a good language. I disagree. I don't want operator overloading. I almost never used operator overloading in C# or Java. Maybe that's just me, but it's certainly not a reason to avoid a language.

The crux of his argument is that C++ users who switched to Java years ago are the types of programmers that Go wished to convert.

He neglects to mention deployment. He neglects to mention stability in runtime. He neglects to mention any low level meddling that you have to do in compression. The examples you posted are exactly the kind of things that Go soars in. It's very convenient to leave them out while beating your chest about how your language is a superior language because it is superior in a very specific niche.

Post reply on HN