Subj : Re: What changed with JS prototype usage? To : Peter Wilson From : Brendan Eich Date : Sun Dec 12 2004 10:03 pm Peter Wilson wrote: > I have been away from Mozilla development for several years. > I am attempting to resurrect some old code before embarking on a re-design. > > The original working code that now crashes has been in a jar file for > all this time and has not changed. > The following idioms used to work but are now silently ignored: > > > function foo() { > this.mx = null; > } > > foo.prototype.bar = function() { > } > > foo.prototype.__defineGetter__('x', function() { > return this. mx; > }) > Works for me, as far as it can work: $ Linux_All_DBG.OBJ/js js> function foo() { this.mx = null; } js> js> foo.prototype.bar = function() { } function () { } js> js> foo.prototype.__defineGetter__('x', function() { return this. mx; }) js> bar = new foo [object Object] js> bar.x null js> bar.x=42 13: TypeError: setting a property that has only a getter > When I step through the code loading using Venkman, function foo() is > loaded, the other functions are skipped. Did this become illegal at some > point? What do you mean 'are skipped"? The other functions are expressions used in statements that should execute in order, as part of the script you show that starst with "function foo() {\n" and ends with the line "}\n". Are you by any chance failing to execute the script, instead using JS_ExecuteScriptPart(...JSEXEC_PROLOG...)? /be .