Open gfredericks opened 11 years ago
I don't follow why we'd need a macro. What keyword would we be parsing?
E.g., (laser/css :div#content.whatsit)
will have to parse that keyword every time it gets called, assuming it's a function. If it were a macro it could emit the (laser/and ...)
code if its argument were a keyword, and fallback to runtime processing otherwise.
Well, we should use a string and not a keyword probably. But I see your point. I don't think I care very much though. I'd just make it a function.
I kind of miss clojurescript's "a macro and a function by the same name" feature.
My hunch is that the biggest performance aspect (overall) is parsing the source (pre-transformed) HTML into a Clojure data structure. Is that cached?
I would think that parsing a Clojure keyword (e.g. :div#content.whatsit
) would pale in comparison.
Clean simple functions are good, but 96% of the time the CSS selector syntax is much succincter. Questions:
Naming
css
presumablyArgument
A vector? A string? Any stringish thing? Any of the above?
Macro?
Arguably parsing a damn keyword every time your function is called can be expensive especially when a macro might be able to do it at compile time (like hiccup). But also macros are terrible.