Naming code, the value-identity relation
a day ago
- #programming
- #clojure
- #naming
- Naming things is one of the two hard problems in Computer Science, alongside cache invalidation.
- Names serve as layers of indirection or abstraction, crucial for managing complexity in software development.
- Software engineering involves creating numerous names, yet naming is rarely discussed in depth in computer science education.
- Clojure's `def` creates a global var with a symbol as identity, which is replaced by its value upon evaluation.
- Clojure.spec's `def` uses namespaced keywords as identities, differing from Clojure's `def` which uses symbols.
- The post explores the idea of using compound identities for `clojure.spec/keys` to avoid defining separate specs for each combination of keys.
- An example demonstrates defining a spec based on a combination of namespace-keywords without creating a new named spec.