The coolest thing about :keywords in Clojure is that they really are functions and you can do things like (map :keywords ontoSomething) to extract the same property out of many things. It don't work in Wisp.
The coolest thing about :keywords in Clojure is that they really are functions and you can do things like (map :keywords ontoSomething) to extract the same property out of many things. It don't work in Wisp.
That's basically what keywords do -- they are human-readable and compile down (prob. using some hash) into some integer, and the integer is stored globally only once. The biggest savings in memory comes when using maps, and that's how & why keywords get their name.
Also, Java declared java.lang.String as final, so Strings can't be extended to implement clojure interfaces to get nice behavior, like IFn and IKeywordLookup.
Ok. That sucks. So pretty much anyone already a bit serious about Clojure wont be enticed by this then.
Edit: From the page:
;; Keywords can be invoked as functions, that desugars to plain
;; associated value access in JS
(:bar foo) ;; => foo["bar"]
That seems pretty close to what's expected though, doesn't it?