News for hackers. Stuff that matters.
Re:Type systems are leaky abstractions: the case of Map.take!/2 by Xophmeister on Sunday March 15, 2026 @09:50PM (#47394194)
Surely type checking on the keys of effectively arbitrary maps is just a folly. Maps shouldn’t be used for these purposes. If you know the members at compile time, then put them in a proper record type, like a struct or dataclass, etc.
Re:Type systems are leaky abstractions: the case of Map.take!/2 by hirsin on Sunday March 15, 2026 @11:03PM (#47394742)
Right - it feels like going skin deep on types and then complaining they didn't solve for very deep problems.

Like yes, it would be nice for Map(ICar[] cars, keys).wingspan to throw a type error because cars is typed and we know keys can't include things not in ICar.

But to say that Map(Any[] things, keys) should have ahead of time type checking seems like you're not really using types except when inconvenient. Which might be taken as a no true scotsman or "holding it wrong" argument but... Maybe they are holding it wrong.

(Speaking as a former Windows/CLR PM now working in a Ruby monolith... It's hell and indeed trying to add types via sorbet has been miserable and useless)

Re:Type systems are leaky abstractions: the case of Map.take!/2 by jiehong on Monday March 16, 2026 @12:23AM (#47395204)
The basis of Erlang/Elixir/Clojure is that structs are just inflexible maps.

So, this is trying to tackle and type this instead.

It’s not wrong, just a different vision.

Re:Type systems are leaky abstractions: the case of Map.take!/2 by ddellacosta on Wednesday March 18, 2026 @06:18PM (#47432102)
> The basis of Erlang/Elixir/Clojure is that structs are just inflexible maps.

I mean the difference is that Erlang and Elixir have high-quality pattern matching baked in, not to mention stuff like dialyzer and set-theoretic types.

Clojure has multi-methods I guess, and stuff like defrecord that no one uses...and the turd that is spec. In my experience every Clojure codebase turns into map soup at some point without a tremendous amount of manual labor.

...so it's not as black and white as you're saying, I guess is my point. And for example, I'd always take Haskell over Erlang or Elixir even though Haskell's records are widely and justifiably derided, because the language taken as a whole is that much nicer to use, and stuff like lens smooths some of the rough edges over pretty well.

Re:Type systems are leaky abstractions: the case of Map.take!/2 by ddellacosta on Monday March 16, 2026 @12:46PM (#47401402)
I dream of a day when everyone is using statically typed languages that support row polymorphism a la PureScript (https://book.purescript.org/chapter4.html#record-patterns-an...)...
Re:Type systems are leaky abstractions: the case of Map.take!/2 by jaen on Wednesday March 18, 2026 @10:46AM (#47426468)
TypeScript has row polymorphism at home.
Re:Type systems are leaky abstractions: the case of Map.take!/2 by ddellacosta on Wednesday March 18, 2026 @05:53PM (#47431898)
I lol'ed