Naming code, the value-identity relation

2 weeks ago 1

It seems that clojure.core/def is exactly about this relation, and clojure uses a symbol value as identity. Once the relation is internalised (evaluated), the identity/symbol will be replaced by the value of that naming relation.

So, that's clear, and also, that identity choice (namespaced symbol) is semantically "place oriented": 'folder-path-and-file/symbol-name.

But, identities don't need to be "an always one and only one value replacement relation". An example of that is clojure.spec/def

(require '[clojure.spec.alpha :as s]) (s/def ::foo string?) (eval ::foo)

clojure.spec/def is not only different from clojure/def for that. clojure.spec chooses namespaced-keyword as identity values, but clojure/def chooses symbols for the same.

There are tons of good consequences from using namespaced keywords that I've already talk about it on "Decomplecting clojure.spec: From validation to self-discoverable semantic services", thus I'll not get into that now. In this post I'd like to get into the 1-1 identity-value relation.

Read Entire Article