Re: [JSMentors] Null prototype and inheritance

2011-11-03 Thread Asen Bozhilov
Nick Morgan: Now, if you do this instead: Ctor.prototype = null; var y = new Ctor; y.toString; = function ... Here's a fiddle that illustrates the above: http://jsfiddle.net/skilldrick/gabEN/ So, how is `toString` looked up on `y`? Is there a special case when the

Re: [JSMentors] Prototype.constructor does this do something ?

2011-10-25 Thread Asen Bozhilov
2011/10/25, Arian Stolwijk ar...@aryweb.nl: instanceof only looks at what's in the prototype chain: http://jsfiddle.net/AZbvp/ Please post the code directly in your message next time. I don't know how jsfiddle manages its shared codes, but if it expires it will be lost for JSMentors archive.

Re: [JSMentors] How to restore Object.prototype.hasOwnProperty if it has been overwritten?

2011-09-07 Thread Asen Bozhilov
Lasse Reichstein: You can use either Object.getPrototypeOf or __proto__ (with a preference on the other, because it's not as easily modified) to check: prop in object !(prop in object.__proto__) which is not same check as hasOwnProperty (if the property is both on the object and also in

Re: [JSMentors] Fun interview question with function expressions

2011-09-06 Thread Asen Bozhilov
gaz Heyes gazhe...@gmail.com: I found this which was quite surprising: !function x(){x=123;alert(x);}() What's the value of x without running the code? Should be `function x(){x=123;alert(x);}`, while NFE adds in front of the scope chain `x` which value can't be overwritten so in the body

Re: [JSMentors] ES5 shims

2011-08-30 Thread Asen Bozhilov
Stoyan Stefanov: What ES5 shims are you using that you can recommend? As you know some of the general ES5 features cannot be implemented in ES3 environment. Those which rely on internal properties and their values in most cases cannot be emulated. For example `defineProperty',

Re: [JSMentors] Zakas Blog == Censored

2011-05-21 Thread Asen Bozhilov
Via the JSMentors mailing list you can: Discuss ECMA-262 standard Discuss different implementations of ECMA-262 Discuss different host environments of JavaScript Discuss implementation of algorithms in JavaScript Discuss your library design Review your code Review your book on JavaScript topic

Re: [JSMentors] Does a function always keep its reference to the outer scope?

2011-04-22 Thread Asen Bozhilov
Anton Kovalyov: We were talking with colleagues about closures and this question came up. When JavaScript interpreters parse a function, do they always keep its reference to the outer scope or do they keep it _only_ when needed (i.e. when something inside the function accesses variables from

[JSMentors] Donations

2011-04-20 Thread Asen Bozhilov
Hi everyone. We launched donations for JSMentors trough the PayPal: URL: http://jsmentors.com/ The collected money will be used for the hosting, domain name, conferences and some reconstructions of the site. Any amount of donation is highly appreciated. Thank you very much! -- To view

Re: [JSMentors] Re: Bad Coercion Advice from a Guru (or why you should question everything)

2011-04-13 Thread Asen Bozhilov
J.R.: Instead of: if (window.ActiveXObject) { We should use: if (typeof window.ActiveXObject !== undefined) { I would not use both approaches. I would use: if (typeof ActiveXObject != 'undefined') { //... } Or as Diego proposed: if ('ActiveXObject' in this) { //... } When this

Re: [JSMentors] Choosing between two ways to obviate global namespace pollution

2011-02-23 Thread Asen Bozhilov
jemptymethod : I inherited some code that essentially does this: You should consider how these changes will affect on existing code in your application. In order to prevent incompatibilities with existing code, you should decide the best approach for you. user = deserializeUser(params); //var

Re: [JSMentors] Nested Property Access

2011-02-15 Thread Asen Bozhilov
Sam Merrell: What are the groups thoughts on safely accessing a nested objects value that may be undefined? Firstly you should answer on the question, are you going to create objects which properties value may be undefined? I recently came across a blog post [1] from Oliver Steele where he

Re: [JSMentors] Re: Javascript JSON parser according ECMA-262-5 JSON grammar

2011-02-15 Thread Asen Bozhilov
Scott Sauyet: Not at all. Have you done any performance tests? I haven't yet. I am planning to test against built-in JSON.parse and various Crockford's implementation. I have made front-end for this code: URL:http://asenbozhilov.com/json.html You can use it as a validator of your JSON

Re: [JSMentors] Re: Javascript JSON parser according ECMA-262-5 JSON grammar

2011-02-15 Thread Asen Bozhilov
Diego Perini: I have one question, without having gone through reading the specs. Would it be useful, and still spec compliant, to detect an Invalid leading comma too as an error instead of a Invalid property name ? You already detect the Invalid trailing comma and the passed objects could

Re: [JSMentors] Re: Javascript JSON parser according ECMA-262-5 JSON grammar

2011-02-11 Thread Asen Bozhilov
Scott Sauyet: I look forward to seeing it. Nice job so far! I implemented abstract `walk` operation and therefore I added an optional argument `reviver'. Both are according ECMA-262-5. You can see the changes: URL: https://github.com/abozhilov/json/blob/master/src/json.js Also I changed the

Re: [JSMentors] Re: Javascript JSON parser according ECMA-262-5 JSON grammar

2011-02-09 Thread Asen Bozhilov
Scott Sauyet : Have you considered allowing a reviver function? Perhaps it's not important to your testing and debugging purposes, but it might be an interesting extension... The main goal was to create proper parser, but I like the idea for reviewer function and I'll add it. I made some

Re: [JSMentors] Note 4. Two words about hoisting.

2011-02-07 Thread Asen Bozhilov
Dmitry A. Soshnikov : http://dmitrysoshnikov.com/notes/note-4-two-words-about-hoisting/ Excellent article. The most interesting example for me was: // a.js function foo() { alert(1); } foo(); // 2 ? // b.js function foo() { alert(2); } Which demonstrates how Function Declarations are

[JSMentors] JSMentors - logo designer

2011-02-06 Thread Asen Bozhilov
JSMentors is looking for logo designer who is able to create the logo of JSMentors. While we are not commercial organization, we are not able to pay for this. We are only able to add the name of the creator at the main site of JSMentors: URL: http://jsmentors.com If someone is interested please

Re: [JSMentors] JSMentors - logo designer

2011-02-06 Thread Asen Bozhilov
Miller Medeiros: why not create some sort of contest? I and Rey thought about it. The our idea was to create competition and giving the vote to members of JSMentors. We are able to create a page with proposed logos, their authors and ideas behind the design. The problem is that, while we are

[JSMentors] Technical discussion - Do not be too rude or too sensitive

2011-02-05 Thread Asen Bozhilov
When we launched the JSMentors the our goal was to provide place where we can share the our opinion and knowledge in Javascript and browser scripting. Here are welcome any level developers. We achieved these goals and the moment JSMentors has over 1200 members who are different level developers.

Re: [JSMentors] localStorage - special setter and getter

2011-02-03 Thread Asen Bozhilov
Juriy Zaytsev : But is it a bug really? As far as I know, web storage spec ( http://dev.w3.org/html5/webstorage/) makes no clarification on whether interface members are writable; or enumerable/configurable for that matter. WebIDL spec, however, does mention something about interface members

[JSMentors] localStorage - special setter and getter

2011-01-29 Thread Asen Bozhilov
The last week I explored some things about `localStorage'. The most interesting and meanwhile confusing things are described in two articles about `localStorage': URL: http://www.bennadel.com/blog/2105-Exploring-HTML5-s-localStorage-Persistent-Client-Side-Key-Value-Pairs.htm URL:

Re: [JSMentors] JSFiddle as a requirement (was: Addressing DOM)

2011-01-24 Thread Asen Bozhilov
אריה גלזר arieh.gla...@gmail.com: BTW - if any of you find other tools more comfortable - like jsbin - that's fine too, my point is t separate code from message I am not sure how this is helpful. With Rey we are working on posting guidelines and of course there will be point about code

Re: [JSMentors] Re: Introductions

2010-12-19 Thread Asen Bozhilov
Garrett Smith wrote: On 12/18/10, Marc Harter wav...@gmail.com wrote: My name is Marc Harter (@wavded). I'm stationed in Eau Claire, WI and work with JavaScript daily. Very glad this list is here, was turned off by c.l.js spam and trolling Can't remember seeing any posts from you

Re: [JSMentors] Can I dynamically make a prototype link?

2010-12-19 Thread Asen Bozhilov
Juriy Zaytsev wrote: Is Brendan on this list? Unfortunately he is not at the list. I've sent invitation to him, be he hasn't replied yet. I hope he would join at the list. Also Douglas Crockford would accept and his invitation. -- To view archived discussions from the original JSMentors

Re: [JSMentors] What's the best way to implement Object Inheritance?

2010-12-17 Thread Asen Bozhilov
qwertypants: I'm a bit new to Object Inheritance in JavaScript and I'd like to find the best way to do so. I have seen a few techniques from Resig to Crockford, but I'd like to know the simplest and most effective way to create object from existing ones. Is there any native way that this can

Re: [JSMentors] Can I dynamically make a prototype link?

2010-12-17 Thread Asen Bozhilov
Garrett Smith wrote: Juriy Zaytsev wrote: var beget = (function() { function F(){ }; All good except for the extra empty statement there. AYK, semicolon is not needed after the FD. I guess this is typo according knowledge of Juriy. Anyway, more important is discussion about

Re: [JSMentors] eval indirect call (this.eval)

2010-12-16 Thread Asen Bozhilov
JSDude wrote: this.eval — as I understand right is Reference, where ReferenceName is eval. I'm always think that this is global eval because it's evaling in context window. The simple answer on your question is: eval('...'); The evaluation of MemberExpression return Reference which in