Raynes / laser

HTML transformation/templating for people who do that sort of thing and stuff
120 stars 16 forks source link

It don't got CSS selectors #17

Open gfredericks opened 11 years ago

gfredericks commented 11 years ago

Clean simple functions are good, but 96% of the time the CSS selector syntax is much succincter. Questions:

Naming

css presumably

Argument

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.

Raynes commented 11 years ago

I don't follow why we'd need a macro. What keyword would we be parsing?

gfredericks commented 11 years ago

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.

Raynes commented 11 years ago

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.

gfredericks commented 11 years ago

I kind of miss clojurescript's "a macro and a function by the same name" feature.

xpe commented 10 years ago

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.