Remix.run Logo
Xophmeister 7 hours ago

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.

hirsin 5 hours ago | parent | next [-]

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)

jiehong 4 hours ago | parent | prev [-]

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.