News for hackers. Stuff that matters.
Re:Revisiting the principles of data-oriented programming by weavejester on Sunday June 26, 2022 @10:24AM (#31884282)
siknad and uryga give good replies on dependent types and TypeScript's structural typing. There's also an experimental static typing system for Clojure that allows for typing of maps:

    (defalias NamedMap
      (HMap :mandatory {:first-name Str, :last-name Str}))

    (ann  full-name [NamedMap -> Str])
    (defn full-name [{:keys [first-name last-name]}]
      (str first-name " " last-name))
If you can determine some subset of the keys of a map at compile type, then you can type check it to some degree.

There are no comments on this comment yet.