News for hackers. Stuff that matters.
Re:Go is not an easy language by citrin_ru on Monday February 22, 2021 @03:18AM (#26222068)
> Most experienced programmers will realize this is a linear search and that it may be slow on large arrays.

Experienced programmer can think that values in a list with such operation are indexed by a hash and delete by value is O(1) unless there is a big warning in documentation. Novice programmer probably haven’t seen such combination of an array and a hash table and will assume O(N) as taught in a college.

Re:Go is not an easy language by thezilch on Monday February 22, 2021 @04:02AM (#26222294)
Experienced programmers, if perf matters to their project, should think about their data structures, memory size, and access patterns. It's not clear why an experienced programmer would think an array defaults to wasting memory on a hash table. Why use an array, if they need lots of values and to delete them at random?
Re:Go is not an easy language by wizzwizz4 on Monday February 22, 2021 @03:23AM (#26222100)
Experienced programmers will know that such a thing is possible, but I've never seen any (non-JavaScript, non-PHP) language where primitive arrays involve a hash table.
Re:Go is not an easy language by Gaelan on Monday February 22, 2021 @03:42AM (#26222194)
And even in JS and PHP (and Lua) where arrays and hash tables are technically the same data structure, a hash table used as an array isn't actually indexed on elements, just numbers, so you don't get O(1) search.
Re:Go is not an easy language by shakow on Monday February 22, 2021 @06:18AM (#26223224)
Experienced programmer will know whether the vanilla array of the language they use feature this kind of convoluted data structure.

Which, for virtually all languages, is “obviously not”.