to list -> On Fri, Jun 27, 2008 at 3:04 PM, Brendan Eich <[EMAIL PROTECTED]> wrote: > On Jun 27, 2008, at 2:07 PM, Garrett Smith wrote: > >> A program that called pop() on an object w/no length would know right >> away if it failed. > > Why do you say that? >
I worded that very poorly. It was in response to:- "There does not seem to be any profit in taking risk by changing the semantics." - I should have written: The algorithm could be changed such that program that called pop() on an object w/no length would know right away. > js> function pizza(){} > js> pizza.prototype.pop = Array.prototype.pop > function pop() { > [native code] > } > js> p =new pizza > [object Object] > js> p.length > js> p.pop() > js> p.length > 0 > js> a = [] > > js> a.pop() > js> > > >> Now, in the hypothetical scenario, would some built-in algorithmic >> safety checks help fail faster? Checks for 1) hasOwnProperty and not >> readonly or 2) has a setter > > Again, we don't know what failing faster (you mean throwing a new error as > an exception) would break. The shell session above shows how fail-soft could > leave scripts executing and even behaving well. Throwing an exception that's > not caught would rain on such scripts' parades. I hardly call that a parade. It looks like a toy program aimed at doing nothing useful. If your argument is addressing an object which does not have an own property - length -, then what about calling - pop - on an object that a) has a getter and no setter for - length b) has a - length - property with the attribute ReadOnly (the NodeList example). How do you address these concern? Is it better to fail fast or fail later? If later, and in the case or attempting to set a ReadOnly property, then should the failure be silent? (String example). What about the NodeList example? BTW, I am keeping this on ES4 list. IMO, having fewer lists keeps things simpler (fewer language versions would also seem to be simpler). Garrett > > /be > > _______________________________________________ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss