Live data from Hacker News

Go Chainable: .map().filter().reduce() in Go

github.com

41–50 of 60 posts

Re: Go Chainable: .map().filter().reduce() in Go

#41
post #8

I hate this. I don't know why people insist on forcing this programming style into every language. Loops exist for a reason. They are simple, they work, and nine times out of ten, they are faster than this crap. Not every program needs to be golfed down to one line.

You could very easily say the same thing about goto vs structured loops, for example:

  "I hate this. I don't know why people insist on forcing this programming style into every language. Goto and labels exist for a reason. They are simple, they work, and nine times out of ten, they are faster than this crap."
It's just a more structured way to express common operations that we use loops for, and it does has objective technological advantages over raw loops when implemented and used correctly.

As for performance, that is going to vary language to language, but in general iterator processing pipelines are not slower and can even be faster than raw loops. Whether this is the case in Go, I have no idea.

With all of that being said, I am not sure if I would use this style of programming in Go since it doesn't feel idiomatic (yet?).

Re: Go Chainable: .map().filter().reduce() in Go

#42

Are there people with experience in a wide variety of languages that prefer Go? I've only used it in passing, but everytime I see examples they're verbose and look clunky. For example, the chainable methods are nice, but comparing to JS looks more like ES5 than modern code. Do you find Go preferable to other languages for solo projects?

I am no fan of Go's design, other than the small Oberon-2 influence it got.

However, I will definitly advocate its use against C for userspace applications.

Re: Go Chainable: .map().filter().reduce() in Go

#43

Earlier quoted context omitted.

A bad programmer can make a mess in any language, including Go. A great example is this .map().filter().reduce() joke we're looking at today. Well-written Go is absolutely sublime.

I would argue that one of Go's strengths is its resistance to bad code. Sure, you can still write gross Go. But I'll take gross Go over gross C++, gross Haskell, or gross Python any day.

I agree with the sentiment. Go is definitely more resistant to bad code than any other language I know. I'll take bad Go over bad Rust or bad C++ any day, but unfortunately bad Go is pretty prevalent these days...

Re: Go Chainable: .map().filter().reduce() in Go

#44

Are there people with experience in a wide variety of languages that prefer Go? I've only used it in passing, but everytime I see examples they're verbose and look clunky. For example, the chainable methods are nice, but comparing to JS looks more like ES5 than modern code. Do you find Go preferable to other languages for solo projects?

People who prefer golang use it _because_ it is verbose. Nothing is implicit and that makes good easy to read.

25 years ago....

"People who prefer Java use it _because_ it is verbose. Nothing is implicit and that makes good easy to read."

The irony.

Re: Go Chainable: .map().filter().reduce() in Go

#45

Are there people with experience in a wide variety of languages that prefer Go? I've only used it in passing, but everytime I see examples they're verbose and look clunky. For example, the chainable methods are nice, but comparing to JS looks more like ES5 than modern code. Do you find Go preferable to other languages for solo projects?

People who prefer golang use it _because_ it is verbose. Nothing is implicit and that makes good easy to read.

This is me. I've been programming for decades, and the simplicity of Go appeals.

Projects like OP's just tell me that OP doesn't understand Go, and why Go was designed the way it was. They're trying to make this cool thing from another language (that they understand and know how to use) work in Go. But if they really understood the philosophy behind Go they wouldn't be doing this (and their life as a Go programmer would be a lot easier).

But then, I had the same experience coding in Rails. I hated all the magic, the "if you do this then Rails will automagically do that". I want my program to do something because I have specifically written it to do that thing. No surprises, no hidden layers of abstraction. Nothing implicit. I spent a lot of time fighting the magic and trying to write simple, verbose code in Rails. It wasn't fun.

Re: Go Chainable: .map().filter().reduce() in Go

#46

Are there people with experience in a wide variety of languages that prefer Go? I've only used it in passing, but everytime I see examples they're verbose and look clunky. For example, the chainable methods are nice, but comparing to JS looks more like ES5 than modern code. Do you find Go preferable to other languages for solo projects?

yes go is my preferred language for solo projects. Mostly because of tooling. I easily get binaries for all platforms, lot of errors are caught by its compiler. It packages everything in single binary which means less operational overhead. Its standard library contains most of the things that you need for web services so it doesn't require lot of dependencies. It is widespread enough to have a rich ecosystem if i do need something outside standard library.

There are some drawbacks too but i guess more experienced you are in any language more issues you will discover with it but you also learn to workaround them.

Re: Go Chainable: .map().filter().reduce() in Go

#47
post #10

Are there people with experience in a wide variety of languages that prefer Go? I've only used it in passing, but everytime I see examples they're verbose and look clunky. For example, the chainable methods are nice, but comparing to JS looks more like ES5 than modern code. Do you find Go preferable to other languages for solo projects?

>Are there people with experience in a wide variety of languages that prefer Go? Other than Go, I have varying levels of experience in C, C#, Common Lisp, Python, (embedded) assembler, Fortran, Tcl, PHP, and maybe a few other languages I screwed around with for fun. At first I really really liked Go, and I grew to loathe it. I still think Go probably excels in large software development shops where some of its design…

> The documentation[0] actually recommends that you copy-paste your entire codebase into a separate v2/ subdirectory and then maintain that.

That's not the documentation though. Just a blog post. The documentation [0] recommends a branch be created. Creating a directory is not even mentioned.

[0] https://go.dev/doc/modules/major-version

Re: Go Chainable: .map().filter().reduce() in Go

#48

Are there people with experience in a wide variety of languages that prefer Go? I've only used it in passing, but everytime I see examples they're verbose and look clunky. For example, the chainable methods are nice, but comparing to JS looks more like ES5 than modern code. Do you find Go preferable to other languages for solo projects?

Yes! I don’t “like” it in the same way I enjoy Crystal or Ruby syntax, but I like it as a pragmatic choice: it’s fast, it’s simple, it’s predictable and boring. I have extensive experience with node.js and would choose Go over it most of the time. It reduces the mental and maintenance overhead significantly.

Re: Go Chainable: .map().filter().reduce() in Go

#49
post #21

Are there people with experience in a wide variety of languages that prefer Go? I've only used it in passing, but everytime I see examples they're verbose and look clunky. For example, the chainable methods are nice, but comparing to JS looks more like ES5 than modern code. Do you find Go preferable to other languages for solo projects?

I’m fluent in JS/TS, Python, C++ and Go. Despite that I legitimately love all these languages for different sets of reasons, Go is, by a fair margin, my go-to. After 15 some-off years of writing code, to me, the most key component to a language is the ability to grok a new codebase written in it quickly and be able to contribute with as little fuss as possible. The potential network effects to this are huge, and Go’s…

I think this speaks to why I’ve decided to pick it up despite it lacks of offerings to something like Python. I know anywhere I go (haha) the syntax won’t be too convoluted with syntactical sugar seen in other languages (for example I’m using Swift as the base language of reference due to the project and damn does that language have a lot of sugar).

Re: Go Chainable: .map().filter().reduce() in Go

#50

Are there people with experience in a wide variety of languages that prefer Go? I've only used it in passing, but everytime I see examples they're verbose and look clunky. For example, the chainable methods are nice, but comparing to JS looks more like ES5 than modern code. Do you find Go preferable to other languages for solo projects?

> Are there people with experience in a wide variety of languages that prefer Go?

I used to love Go, but that my "wide variety" of language experience was mostly all dynamic languages.

My current opinion of Go in short is:

> Gives micro-level simplicity at the cost of macro-level complexity

Post reply on HN