Skip to content

zz note: type first programming

David Jeske edited this page Jun 19, 2019 · 1 revision

Looking at zz note: important dynamic programming patterns, one important dynamic programming pattern is type-first programming. Related concepts are type-directed programming, and types-as-namespaces.

By this we mean, that arguments become a symbol space for finding methods, rather than having to fully specify among global function names. Consider the following Python code:

a = "my String"
String.toLower(a)  # function first
a.toLower()        # type first

In Clojure, java interop enables this through doto:

(def a "my String")
(.toLower a)               ; function first
(doto a (.toLower))        ; type first