by zackzackzack on 4/29/13, 6:25 PM with 49 comments
by jlongster on 4/29/13, 6:58 PM
However, macros for javascript are being worked on. sweet.js is coming along really well, and just needs to continue ironing out bugs and maturing. http://sweetjs.org/ I believe that it could have a profound effect on JavaScript, such as parsing selector string at expand time.
by k3n on 4/29/13, 8:00 PM
Also, wouldn't it be more accurate for the selector testing to actually test against Sizzle[1]?
Other features aren't even present in jQuery, such as templating, and so I'm not sure why you'd even compare that. Yes people can and do use templates with jQuery, but that's an implementation detail and is not a concern of the library itself; jQuery does not coerce or force you to use a slow templating system, and most any good templating system will also have a compilation step that is run at build-time. So yeah, you can take some ugly userland jQuery example code and make specific code that is faster..
by olenhad on 4/29/13, 7:07 PM
by d0m on 4/29/13, 8:25 PM
If it ends being javascript string in the ends, how is it 7x faster (or whatever number)? I mean, sure the compiler could optimize a part of my code, but other javascript compiler could do it to.. right?
Although I find the Clojure example very sexy, I don't like how the examples tries to compare to contrived Javascript. I.e. I've been coding javascript for a couple years and I've never used jQuery "sort/filter/slice". But more importantly, it uses pre-defined function in Dommy but not in javascript. For instance:
(->> (sel [:ul.my-list :li])
(sort-by #(-> % (sel :input.last-name) .-value))
This uses sort-by where there's: function(a, b) {
return (
$(a).find('input.last-name').val()
.localeCompare(
$(b).find('input.last-name').val()
)
);
in Javascript.. Obviously, I can say: $('ul.my-list li').sortBy(function(x) { return x.attr('last-name'); }
My point isn't that much that jQuery is longer/shorter, but mostly that if two examples in two different languages are to be compared, it makes sense to use the same function.. where in this case sort-by is a high-level sort.>> One is the loneliest number
It's not just "1" or "more than one", it's also zero. Iterating on a list makes it such that you can freely think in a high-level way about the operation and not about the exceptional cases. I.e. $('.blabla').hide(); It Just Works.
>> (mapv #(add-class! % :first-ten-adults)))
Yes, of course you can use map.. but using $('..').addClass('first-ten-adults') makes it so much easier to deal with, instead of knowing what works on one object, what works on multiple objects, what will throw an error if there's nothing, etc.
Meh.
I think Dommy is a great library but the author didn't do a great job at explaining why it rocks. I guess attacking a very popular language with its most popular library doesn't help :p
by st3redstripe on 4/29/13, 7:06 PM
by aria on 4/29/13, 6:34 PM
by codewright on 4/29/13, 8:30 PM
by j_m_b on 4/30/13, 1:56 PM
I also want to mention webfui (https://github.com/drcode/webfui). It is authored by Conrad Barski, who also wrote Land of Lisp. He gave a nice talk about it at the Chicago Clojure meetup group a few months back. He is a fellow hacker news user so I figured he deserved a shout out.
by dmix on 4/29/13, 8:27 PM
So it continues to only be the ideal choice for pet projects.
by iamleppert on 4/30/13, 1:26 AM