Nicolas Martyanoff on Nostr: The old experimental Go maps package was very useful. Infortunately since 1.23 the ...
The old experimental Go maps package was very useful. Infortunately since 1.23 the new stable maps package only returns iterators, so every time you need a slice you have to wrap the call with slices.Collect.
I understand the appeal of iterators for optimization (less intermediary allocations), but I'm not a fan of the growing complexity of the langage (e.g. "func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool", not it's not a joke).
Published at
2025-01-08 15:30:10Event JSON
{
"id": "a4f249c2b7b2d777b67488ecc9fdb08c3db0a5521be82443877eeaa00c6f4c84",
"pubkey": "6d91e7b056ab18986298e04a8b278a5e070a726487fd30a599427c79db9070e9",
"created_at": 1736350210,
"kind": 1,
"tags": [
[
"proxy",
"https://fosstodon.org/users/galdor/statuses/113793447393588480",
"activitypub"
]
],
"content": "The old experimental Go maps package was very useful. Infortunately since 1.23 the new stable maps package only returns iterators, so every time you need a slice you have to wrap the call with slices.Collect.\n\nI understand the appeal of iterators for optimization (less intermediary allocations), but I'm not a fan of the growing complexity of the langage (e.g. \"func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool\", not it's not a joke).",
"sig": "4170cab44b6d3eace45173123858d51dd6d25b57848f23744a92c214844ea7b54468f9a7459c6725951bfa523c316f61d943673d06b712ef0a7c2cf9294a4706"
}