We can collect all symbol/keyword literals during analysis - we can emit a
static symbol/keyword table at the top and replace with direct identifiers
when we compile. We can change the symbols/keyword fn to create
symbol/keyword instances and intern them in a runtime table (the static
table will be
Thanks both for the responses. I'm extending to string for now, which is
fine for my usecase.
- Karl
On Monday, November 26, 2012 9:28:06 PM UTC+1, Krukow wrote:
>
> Hi,
> I'm writing my first ClojureScript program. I defined a protocol for a
> query language which I wanted to extend to various
2012/11/26 David Nolen
> keywords & symbols as proper types is probably not far off and optimizing
> them doesn't need to wait for a general whole program optimization strategy.
>
>
Certainly, gclosure can't generally eliminate the check in: var mykw
= kw_table[kw_str] || (kw_table[kw_str] = new
keywords & symbols as proper types is probably not far off and optimizing
them doesn't need to wait for a general whole program optimization strategy.
David
On Mon, Nov 26, 2012 at 3:42 PM, Herwig Hochleitner
wrote:
> Encoding Keywords as Strings is a performance optimization in
> clojurescript
Encoding Keywords as Strings is a performance optimization in clojurescript.
js/String is in fact extended to IFn to make it work
https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1795
I don't think it is an immutable design choice, but a replacement with
interned Keywo
Hi,
I'm writing my first ClojureScript program. I defined a protocol for a
query language which I wanted to extend to various data types, including
keywords.
However keywords are strings when it comes to dispatch. Is this a bug, or
by design?
ClojureScript:cljs.user> (defprotocol Foo (-a [x] "