Approach of new Object methods in ES5

2010-04-16 Thread Dmitry A. Soshnikov
Hello, I'd like to clarify the question about approach used in ECMA-262-5 regarding the code design for new methods of Object constructor. I've read the section Attribute Control API Design and Rationale of Proposed ECMAScript 3.1 Static Object Functions: Use Cases and Rationale document:

Re: Approach of new Object methods in ES5

2010-04-16 Thread Dean Edwards
On 16 April 2010 13:13, Dmitry A. Soshnikov dmitry.soshni...@gmail.com wrote: I think that approach used in ECMA-262-5 for new object methods contradicts ES nature. +1 The new API seems quite random. I hope that JavaScript is not turning into PHP. -dean

Re: Approach of new Object methods in ES5

2010-04-16 Thread Brendan Eich
On Apr 16, 2010, at 5:28 AM, Dean Edwards wrote: On 16 April 2010 13:13, Dmitry A. Soshnikov dmitry.soshni...@gmail.com wrote: I think that approach used in ECMA-262-5 for new object methods contradicts ES nature. +1 The new API seems quite random. I hope that JavaScript is not

Re: Approach of new Object methods in ES5

2010-04-16 Thread Peter van der Zee
On Fri, Apr 16, 2010 at 2:28 PM, Dean Edwards dean.edwa...@gmail.comwrote: On 16 April 2010 13:13, Dmitry A. Soshnikov dmitry.soshni...@gmail.com wrote: I think that approach used in ECMA-262-5 for new object methods contradicts ES nature. +1 The new API seems quite random. I hope that

Re: Approach of new Object methods in ES5

2010-04-16 Thread Asen Bozhilov
2010/4/16, Dmitry A. Soshnikov dmitry.soshni...@gmail.com: By the way, it is also petty that there's no ability to change prototype and there is only get function for that; __proto__ extension in this case was better. Especially when I want to change only [[Prototype]] and keep values of

Re: Approach of new Object methods in ES5

2010-04-16 Thread Peter van der Zee
On Fri, Apr 16, 2010 at 4:18 PM, Asen Bozhilov asen.bozhi...@gmail.comwrote: 2010/4/16, Dmitry A. Soshnikov dmitry.soshni...@gmail.com: And I have a question. Why ES5 give control on values of internal attributes? What will improve that? Save augmentation of built-in? Good design of JS

Re: Approach of new Object methods in ES5

2010-04-16 Thread Brendan Eich
On Apr 16, 2010, at 7:17 AM, Peter van der Zee wrote: On Fri, Apr 16, 2010 at 2:28 PM, Dean Edwards dean.edwa...@gmail.com wrote: On 16 April 2010 13:13, Dmitry A. Soshnikov dmitry.soshni...@gmail.com wrote: I think that approach used in ECMA-262-5 for new object methods contradicts ES

Re: Approach of new Object methods in ES5

2010-04-16 Thread Brendan Eich
On Apr 16, 2010, at 7:18 AM, Asen Bozhilov wrote: 2010/4/16, Dmitry A. Soshnikov dmitry.soshni...@gmail.com: By the way, it is also petty that there's no ability to change prototype and there is only get function for that; __proto__ extension in this case was better. Especially when I

Re: Approach of new Object methods in ES5

2010-04-16 Thread Brendan Eich
On Apr 16, 2010, at 8:43 AM, Brendan Eich wrote: 2. Extending the language's syntax with: (a) No versioning required in the absence of new reserved identifiers, since new syntax cannot break existing content. Of course I glossed over how new syntax *could* make invalid content start

Re: Approach of new Object methods in ES5

2010-04-16 Thread Brendan Eich
On Apr 16, 2010, at 7:18 AM, Asen Bozhilov wrote: 2010/4/16, Dmitry A. Soshnikov dmitry.soshni...@gmail.com: By the way, it is also petty that there's no ability to change prototype and there is only get function for that; __proto__ extension in this case was better. Especially when I

Re: Approach of new Object methods in ES5

2010-04-16 Thread Erik Arvidsson
On Fri, Apr 16, 2010 at 08:43, Brendan Eich bren...@mozilla.com wrote: ES4 since Waldemar's 1998-era JS2 work was concerned with the problem of versioning APIs implied by (1) greatly, and not just adding properties: deleting and redefining too. ES4 proposed namespaces (like Common Lisp

Re: Approach of new Object methods in ES5

2010-04-16 Thread Brendan Eich
On Apr 16, 2010, at 12:51 PM, Erik Arvidsson wrote: On Fri, Apr 16, 2010 at 08:43, Brendan Eich bren...@mozilla.com wrote: ES4 since Waldemar's 1998-era JS2 work was concerned with the problem of versioning APIs implied by (1) greatly, and not just adding properties: deleting and

Re: Approach of new Object methods in ES5

2010-04-16 Thread Brendan Eich
On Apr 16, 2010, at 12:58 PM, Brendan Eich wrote: However, ES5 *does* allow libraries to bind non-enumerable properties of prototype objects. This is half of the solution, and if the prototype in question is Object.prototype, or perhaps even Oops, missing not: ... if the prototype in

Re: Approach of new Object methods in ES5

2010-04-16 Thread Erik Arvidsson
On Fri, Apr 16, 2010 at 09:06, Brendan Eich bren...@mozilla.com wrote: On Apr 16, 2010, at 7:18 AM, Asen Bozhilov wrote: 2010/4/16, Dmitry A. Soshnikov dmitry.soshni...@gmail.com: By the way, it is also petty that there's no ability to change prototype and there is only get function for

Re: Approach of new Object methods in ES5

2010-04-16 Thread Brendan Eich
On Apr 16, 2010, at 1:11 PM, Erik Arvidsson wrote: On Fri, Apr 16, 2010 at 09:06, Brendan Eich bren...@mozilla.com wrote: ... settable __proto__, apart from the object initialiser use case (i.e., on a new object not yet reachable, analogous to ES5's Object.create), is a terrible idea.

Re: Approach of new Object methods in ES5

2010-04-16 Thread Erik Arvidsson
On Fri, Apr 16, 2010 at 10:28, Brendan Eich bren...@mozilla.com wrote: Object.create is the standardized form of Crock's beget. It's not bad for an API, albeit longer than b-e-g-e-t (but also less likely to collide, although collide it did with TIBET's create method on Object). My main

names [Was: Approach of new Object methods in ES5]

2010-04-16 Thread P T Withington
On 2010-04-16, at 13:07, Brendan Eich wrote: Another Harmony idea: http://wiki.ecmascript.org/doku.php?id=strawman:names for unforgeable property names not equated to any string. These cannot collide, and with sugar to let them be used with . (not only in computed property accesses using

Re: names [Was: Approach of new Object methods in ES5]

2010-04-16 Thread David Herman
Name sounds like a stripped-down uninterned symbol (http://bit.ly/bY3Jkg) to me. Yup. It's an object with a magic attribute that says, unlike any other object you might try to use it as a property name, it is not coerced into a string first. And it is compared by identity when looked

Re: Approach of new Object methods in ES5

2010-04-16 Thread Dean Edwards
On 16/04/2010 14:48, Brendan Eich wrote: On Apr 16, 2010, at 5:28 AM, Dean Edwards wrote: On 16 April 2010 13:13, Dmitry A. Soshnikov dmitry.soshni...@gmail.com wrote: I think that approach used in ECMA-262-5 for new object methods contradicts ES nature. +1 The new API seems quite random.

Re: Approach of new Object methods in ES5

2010-04-16 Thread Asen Bozhilov
2010/4/16, Brendan Eich bren...@mozilla.com: On Apr 16, 2010, at 7:18 AM, Asen Bozhilov wrote: Special thanks for your response! Especially when I want to change only [[Prototype]] and keep values of other internal properties and methods for that object. I write this having designed and

Re: names [Was: Approach of new Object methods in ES5]

2010-04-16 Thread P T Withington
On 2010-04-16, at 14:31, David Herman wrote: Tucker: if the property-nameness attribute weren't transferrable but names were objects with property tables, do you think that would be powerful enough? Or would you want the ability to define custom constructors, e.g.: function

Re: names [Was: Approach of new Object methods in ES5]

2010-04-16 Thread Peter van der Zee
On Fri, Apr 16, 2010 at 9:48 PM, P T Withington p...@pobox.com wrote: On 2010-04-16, at 14:31, David Herman wrote: Tucker: if the property-nameness attribute weren't transferrable but names were objects with property tables, do you think that would be powerful enough? Or would you want the

Re: Approach of new Object methods in ES5

2010-04-16 Thread Peter van der Zee
On Fri, Apr 16, 2010 at 7:11 PM, Erik Arvidsson erik.arvids...@gmail.comwrote: On Fri, Apr 16, 2010 at 09:06, Brendan Eich bren...@mozilla.com wrote: On Apr 16, 2010, at 7:18 AM, Asen Bozhilov wrote: 2010/4/16, Dmitry A. Soshnikov dmitry.soshni...@gmail.com: By the way, it is also

Re: names [Was: Approach of new Object methods in ES5]

2010-04-16 Thread Dmitry A. Soshnikov
Hello David, Friday, April 16, 2010, 10:31:07 PM, you wrote: Name sounds like a stripped-down uninterned symbol (http://bit.ly/bY3Jkg) to me. Yup. It's an object with a magic attribute that says, unlike any other object you might try to use it as a property name, it is not coerced into