News for hackers. Stuff that matters.
Re:Go Analysis Framework: modular static analysis by go team by logicchains on Sunday July 26, 2026 @01:56PM (#49060569)
Your handwritten one has a major performance bug:

    found := false
    for _, v := range s {
        if v == needle {
            found = true
            break
        }
    }
Do you see it? It copies the v into a local variable, which could be tremendously wasteful if it's a large struct. You should instead be taking a pointer to s[i] and comparing the value there with `needle`.

If you'd used `slices.Contains(s, needle)`, on the other hand, it could have such a performance bug in it and you'd never know.

Re:Go Analysis Framework: modular static analysis by go team by kajman on Sunday July 26, 2026 @03:23PM (#49061475)
> If you'd used `slices.Contains(s, needle)`, on the other hand, it could have such a performance bug in it and you'd never know.

Perhaps you're much better at programming than I am, but I prefer these semantics in a language because I figure they're much more likely to have been optimized empirically, support vectorization, and be less buggy than another rote loop I'm trying to speed through.

Re:Go Analysis Framework: modular static analysis by go team by asdf88990 on Sunday July 26, 2026 @09:27PM (#49064170)
That is just a silly rationalisation by primitivists, and they will never be able to articulate any rational point where abstracts makes sense, in their world, whatever Russ Cox and a bunch of Google employees deem fit is the ideal.

Even when Russ Cox and Go team had come to term with reality and stopped pretending like we are in 70s still, these lot will move goalposts. It is a kind of psychosis and sycophancy that is beyond rational discourse.

Re:Go Analysis Framework: modular static analysis by go team by pjmlp on Monday July 27, 2026 @03:15AM (#49066084)
Even the 70's, that is ignoring what was happening with CLU, Smalltalk, Mesa, Modula-2, PL.8, ML, ...
Re:Go Analysis Framework: modular static analysis by go team by boredatoms on Sunday July 26, 2026 @03:37PM (#49061626)
or contains() could be written by those who can write performant code, ..once
Re:Go Analysis Framework: modular static analysis by go team by mathisfun123 on Sunday July 26, 2026 @03:19PM (#49061439)
> on the other hand, it could have such a performance bug in it and you'd never know.

wut...? the debate isn't between closed (incompetent) source and open (competent) source - the debate is between verbose language and expressive language.

Re:Go Analysis Framework: modular static analysis by go team by irq-1 on Sunday July 26, 2026 @04:59PM (#49062342)
You're right. Just for information, slices.Contains() uses the index, not a copied value.

https://cs.opensource.google/go/go/+/refs/tags/go1.26.5:src/...