News for hackers. Stuff that matters.
Re:Three Minor Features in Go 1.18 by hsn915 on Wednesday December 22, 2021 @10:03PM (#29658189)
Whenever I read "modern" javascript code, I'm irritated by the prolifiration of map/filter/reduce.

It makes code harder to read and modify.

A straight for loop is infinitely better in every way.

Re:Three Minor Features in Go 1.18 by dragonwriter on Wednesday December 22, 2021 @11:57PM (#29658805)
I find map/filter/reduce much easier to read if it is being used for a functional map, filter, or reduce operation or something not too distant from it.

> A straight for loop is infinitely better in every way.

A straight for, for-of, or for-in loop, as appropriate, is finitely better for imperative operations that don't naturally fit map/filter/reduce but need to be performed over some set of values.

Re:Three Minor Features in Go 1.18 by scns on Thursday December 23, 2021 @04:05AM (#29660051)
This. Saw a reduce once which contained a lambda one screen long. It gets worse, it contained another reduce...

Ah, and a map that performed side effects.

Re:Three Minor Features in Go 1.18 by hsn915 on Thursday December 23, 2021 @08:50AM (#29661777)
A one line map or filter is ok.

Other than that it's unreadable.

Re:Three Minor Features in Go 1.18 by hiptobecubic on Wednesday December 22, 2021 @10:12PM (#29658249)
This debate is basically just "I learned C first" vs "I learned a higher level language first."
Re:Three Minor Features in Go 1.18 by silisili on Wednesday December 22, 2021 @10:59PM (#29658502)
Disagree. I used Python heavily before Go, and Go is much, much easier to read. I've never seen Go code in any codebase I couldn't immediately follow. I can't say the same about Python, and that's supposedly an easier HLL.

Then again, I learned BASIC first technically, so my brain probably isn't quite right :).

Re:Three Minor Features in Go 1.18 by hiptobecubic on Friday December 24, 2021 @11:56AM (#29675180)
Neither Go nor Python are languages that encourage composing functionality out of higher order functions, so I think the point stands.
Re:Three Minor Features in Go 1.18 by konart on Thursday December 23, 2021 @05:10AM (#29660400)
My learning path was Logo->Basic->Pascal\Delphi->PHP->Python->Ruby and then Go. With some of js here and there.

I don't really think it has much to do with you language path but rather with the field you are working most of the time.

People who are building Rails startups for sale will have opinion different from people who build some sort of integration systems.

Re:Three Minor Features in Go 1.18 by hsn915 on Thursday December 23, 2021 @08:52AM (#29661788)
I learned C first but then I rode the functional bandwagon (and dynamic languages) and spent many many years in Python and Javascript. I thought map/filter was much better than imperative for a long time.

I rediscovered imperative programming later and found it to be such a breath of fresh air.

Re:Three Minor Features in Go 1.18 by pjmlp on Thursday December 23, 2021 @02:24AM (#29659518)
C is high level, many just think it isn't.

DDJ had quite a few articles on how to do Lisp-in-C kind of thing.

Re:Three Minor Features in Go 1.18 by laumars on Thursday December 23, 2021 @04:11AM (#29660083)
You’re a bit quick to comment there because the GP said “highER”. ie another language that is a highER level than C.

So technically their post is correct

Re:Three Minor Features in Go 1.18 by pjmlp on Thursday December 23, 2021 @04:19AM (#29660130)
C provides the tooling to implement many of the necessary abstractions as libraries, hence why I pointed to the DDJ articles.

You can even plug a conservative GC for the full Lisp like experience.

Re:Three Minor Features in Go 1.18 by laumars on Thursday December 23, 2021 @06:53AM (#29660973)
Are you actually reading peoples comments before replying? You’re posting these completely irrelevant tangents as if it’s a contradiction to earlier posts (it isn’t) and in a tone that suggests you’re the only person who knows C (you’re not).
Re:Three Minor Features in Go 1.18 by pjmlp on Thursday December 23, 2021 @07:49AM (#29661340)
Whatever.
Re:Three Minor Features in Go 1.18 by BurningFrog on Wednesday December 22, 2021 @11:45PM (#29658749)
It's a bit messy in JS.

In Ruby the map/filter/reduce handling is very smooth, readable and useful!

Re:Three Minor Features in Go 1.18 by dragonwriter on Thursday December 23, 2021 @05:57AM (#29660641)
> It's a bit messy in JS.

Mainly, IME, because of the combination of JS map, etc., passing extra, infrequently used parameters, and functions you might want to use often accepting optional less-frequently-used parameters, which can end up interacting horribly wrong when you do:

  arr.map(func)
instead of:

  arr.map(v => func(v))
when you want a “simple” map application.