Subj : Re: Proper behavior of uneval(-0.0) ? To : brendan@meer.net From : Igor Bukanov Date : Wed Nov 12 2003 10:31 pm Brendan Eich wrote: > Igor Bukanov wrote: > >> >> Currently in SM uneval(-0.0) gives "0". Should it be "-0.0" instead? > > > I don't think so, based on ECMA-262 Edition 3 9.8.1 step 2. On the > other hand, uneval is an extension. We could make it have a special > case here. I'm hesitant to do that, on general KISS grounds. Is there > a compelling use-case? No: I have found this while implementing uneval in Rhino. I was surprised that SM goes great deals to implement toSource() for functions in a very different way compared with toString() so given function f(i) { while (i < 10) { ++i; } return 1; } f.toString() gives function f(i) { while (i < 10) { ++i; } return 1; } while uneval(f) produces function f(i) {while (i < 10) {++i;}return 1;} with no semantic difference between forms while uneval(-0) would miss the semantically significant minus. It is really a pity that Ecma defines that String(-0) should give 0. Regards, Igor .