|
From: J.S.Criptoff on 18 Apr 2008 13:21 While c.l.j regulars are ridiculing John Resig's first javascript book he's writing the second one - "Secrets of the JavaScript Ninja". He was a javascript Guru. Now he is a javascript Ninja. Hey, it's time to iconize him! Your are invited to pray here: http://ejohn.org/blog/state-of-the-secrets/
From: Thomas 'PointedEars' Lahn on 18 Apr 2008 13:26 J.S.Criptoff wrote: > While c.l.j regulars are ridiculing John Resig's first javascript book It does not need to be ridiculed. Many (if not most) of Resig's statements are provably factually utterly wrong (and have been proven so here), so it provides the ridiculousness by itself already. > he's writing the second one - "Secrets of the JavaScript Ninja". OMG! PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>
From: Gregor Kofler on 18 Apr 2008 14:25 J.S.Criptoff meinte: > While c.l.j regulars are ridiculing John Resig's first javascript book > he's writing the second one - "Secrets of the JavaScript Ninja". He > was a javascript Guru. Now he is a javascript Ninja. Hey, it's time to > iconize him! I thought he was an "evangelist". Anyway, "What does with(){...} do and why is it so useful?" will be one of the topics. PLUS: more class-like implementations in JavaScript. I hope this book will finally put the hipocrites of this group to shame. > Your are invited to pray here: > http://ejohn.org/blog/state-of-the-secrets/ Who knows? If you pray fervently enough, you might be in for a free sample of "Secrets of the JavaScript Ninja". (Or the forthcoming "Way of the JavaScript Samurai".) Gregor -- http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie http://web.gregorkofler.com ::: meine JS-Spielwiese http://www.image2d.com ::: Bildagentur f�r den alpinen Raum
From: Lasse Reichstein Nielsen on 18 Apr 2008 15:48 Gregor Kofler <usenet(a)gregorkofler.at> writes: > Anyway, "What does with(){...} do > and why is it so useful?" will be one of the topics. It adds an object to the scope chain throughout its body. This is one of the two ways to add a level to the scope chain, the other being a function call. Using "with" like a let-construct is dangerous, though. function stepWatch(watch) { for(var i = 0; i < watch; i++) { with({i:i}) { setTimeout(function(){alert(i + " of " + watch);}, i*1000); } } } stepWatch(5); This appears to work fine in IE and Opera (where omitting the "with" construct will alert "5" all the times). Then someone runs it in Firefox, and it alerts: 0 of function watch() { [native code] } The problem with the "with" construct is that you cannot control which properties exist on the object. It differs between browsers (as above), and it can be changed by other, misbehaved, libraries that change Object.prototype. So there, I'm looking forward to hearing why it's so useful :) /L -- Lasse Reichstein Nielsen - lrn(a)hotpop.com DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html> 'Faith without judgement merely degrades the spirit divine.'
From: Gregor Kofler on 18 Apr 2008 16:29
Lasse Reichstein Nielsen meinte: > The problem with the "with" construct is that you cannot control which > properties exist on the object. It differs between browsers (as > above), and it can be changed by other, misbehaved, libraries that > change Object.prototype. > > So there, I'm looking forward to hearing why it's so useful :) Let John respond: Gopal: would consider the "with" statement in JavaScript to be very harmful rather than being useful. John: @Gopal: There's a ton of things in JavaScript that can be "considered harmful". Since JavaScript is such an, extremely, flexible language you can make mistakes all over the place and not catch it. I just think that we need to have a better understanding of how the existing features work to give us a clearer way to move forward and to work with what we have. I hope this makes things *a lot* clearer. Gregor -- http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie http://web.gregorkofler.com ::: meine JS-Spielwiese http://www.image2d.com ::: Bildagentur f�r den alpinen Raum |