Hacker News new | past | comments | ask | show | jobs | submit login

What you're talking about is effectively a type-hint. Clojure supports those like:

(defn get-row-by-id [^Number id] ...) (defn get-row-by-user-name [^String s] ...)

There's also destructuring which both "extracts" local variables from data structures and serves as an informal documentation/description of the data shape.

You can combine type-hints and destructuring for a very powerful effect. Nowadays, I almost never have a problem "remembering" what or what shape of data I need to pass around.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: