From: Lasse Reichstein Nielsen on 18 Feb 2010 01:13 Thomas 'PointedEars' Lahn <PointedEars(a)web.de> writes: > Lasse Reichstein Nielsen wrote: > >> Indeed, it's quite possible to look up a property of Number.prototype >> without creating a new Number object. > > Not in a conforming implementation of ECMAScript Edition 5. There is not > that much room to maneuver here: > > | A conforming implementation of ECMAScript must provide and support all > | the types, values, objects, properties, functions, and program syntax > | and semantics described in this specification. > ^^^^^^^^^^^^^ The semantic algorithms of the specification are descriptive. The only thing that matters is their observable behavior, not their internal implementation details. Creating an object is only observable if a reference to the object escapes. In the case of the object created in the internal [[Get]] method used by GetValue with a primitive base, it is not visible outside the [[Get]] method. Therefore, if an implementation can achieve the same observable behavior without actually creating the object, then it is free to do so. One way of doing that would be to not use ToObject in step one, but instead let O be one of Number.prototype, String.prototype or Boolean.prototype, depending on the primitive type of base. Since a newly created Number object has no (non-internal) properties of its own, its properties will be identical to those of its prototype. Or, to quote ES5 8.7.1: "The object that may be created in step 1 is not accessible outside of the above method. An implementation might choose to avoid the actual creation of the object." /L -- Lasse Reichstein Holst Nielsen 'Javascript frameworks is a disruptive technology'
From: Jorge on 18 Feb 2010 03:15 On Feb 17, 11:01 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote: > > Jorge writes: > >> (...) > >> IOW: "you can cheat if you don't get caught" > > You would. (...) Ha ! You don't know who said that, do you ? http://www.google.com/search?q=%22as+you+don't+get+caught%22+%22alan+kay%22+smalltalk -- Jorge.
From: Dmitry A. Soshnikov on 18 Feb 2010 03:40 On Feb 18, 1:19 am, kangax <kan...(a)gmail.com> wrote: > On 2/17/10 3:16 PM, Dmitry A. Soshnikov wrote: > > > On Feb 17, 10:58 pm, kangax<kan...(a)gmail.com> wrote: > > > [...] > > >> some of ES5 bits are already implemented in, for example, nightly > >> WebKit (and Opera 10.50 alpha, IIRC). > > > Also if interested, almost all features of ES5 (except of "strict > > mode") are implemented in Rhino 1_7R3pre:<URL:ftp://ftp.mozilla.org/pub/mozilla.org/js/>. > > I use it for test - as in sources there's a runnable js-console. > > Did you have to build it? `ant compile` fails here (on Snow Leopard), > and js.jar that's in the root says "Rhino 1.7 release 2 2009 03 22" > Seems, you downloaded the older release (R2), but in R3pre using .jar I have: | Rhino 1.7 release 3 PRERELEASE 2010 01 14 where all this stuff with Object.: create, seel, freeze, getPrototypeOf, property descriptors and so on is available. Direct link: <URL: ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R3pre.zip> I'm not sure how to do this in MacOS, but in WinXP I've just created .bat-file with: java -jar js.jar and run it. Also it's possible to pass a source file as argument. /ds
From: Jorge on 18 Feb 2010 03:48 On Feb 17, 11:27Â pm, Peter Michaux <petermich...(a)gmail.com> wrote: > (...) > I'm not saying the namespacing is required. I'm saying that having to > write eight characters for the name of the function instead of three > characters isn't something to get fussed about. Math.floor(Math.random()*100)) vs. (100).rnd().floor() Math.pow(Math.sin(â),2) vs. â.sin().pow(2) -- Jorge.
From: Thomas 'PointedEars' Lahn on 18 Feb 2010 03:51
Lasse Reichstein Nielsen wrote: > Thomas 'PointedEars' Lahn <PointedEars(a)web.de> writes: >> Lasse Reichstein Nielsen wrote: >>> Indeed, it's quite possible to look up a property of Number.prototype >>> without creating a new Number object. >> >> Not in a conforming implementation of ECMAScript Edition 5. There is >> not that much room to maneuver here: >> >> | A conforming implementation of ECMAScript must provide and support all >> | the types, values, objects, properties, functions, and program syntax >> | and semantics described in this specification. >> ^^^^^^^^^^^^^ > > [...] to quote ES5 8.7.1: > "The object that may be created in step 1 is not accessible outside of > the above method. An implementation might choose to avoid the actual > creation of the object." ACK PointedEars -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.) |