Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread David Bruant
Le 20/01/2013 06:36, Kevin Smith a écrit : It is not. At the exit of the get trap, the JS engine checks whether invariants should be enforced for the given property on the target. In your case, the runtime sees that the target has a non-configurable non-writable property called

Re: An example of the third basic rule of semicolon insertion

2013-01-20 Thread Kang-Hao (Kenny) Lu
(13/01/20 15:07), heathmatlock wrote: Substitute chance for check in the previous email. (I couldn't find your previous mail either in my es-discuss folder or the online archive, though I noticed that this mailing list drops more mails than a usual mailing list at W3C.) On Sun, Jan 20, 2013 at

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Kevin Smith
Got it. And one more (thanks for bearing with me): what affect does throwing an error have within a trap? var target = { foo: function() { this.bar; console.log(after bar); }, bar: 0 }; var proxy = new Proxy(target, { get: function(obj, name) { if (name

Proxy questions

2013-01-20 Thread David Bruant
Le 20/01/2013 16:49, Kevin Smith a écrit : Got it. And one more (thanks for bearing with me) I forked the thread. Go crazy if you have other questions :-) what affect does throwing an error have within a trap? You can think of it as an internal error, very much like Object.defineProperty

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Brendan Eich
David Bruant wrote: I disagree with Brendan when he says to use weakmaps for class private instance methods/variables... well... it depends on what use means: The spec is allowed to /use/ anything it needs to make the class private syntax work. If the spec says that private properties are like

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Brendan Eich
David Bruant wrote: Once again, the spec (well... you in that case :-) ) will do whatever is necessary to make the feature understandable by spec readers. Transpilers will work with whatever is in the language. If they only have weakmaps, they'll use that. See

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread David Bruant
Le 20/01/2013 18:59, Brendan Eich a écrit : David Bruant wrote: I disagree with Brendan when he says to use weakmaps for class private instance methods/variables... well... it depends on what use means: The spec is allowed to /use/ anything it needs to make the class private syntax work. If

Re: Proxy questions

2013-01-20 Thread Kevin Smith
Does the stack unwind as with normal error handling? Does after bar get logged? (FF18 answers yes to the first and no to the second question.) I agree with FF18 here. OK. Consider this: class Purse { private balance; constructor() { balance = 0;

Re: Proxy questions

2013-01-20 Thread Mark S. Miller
Before commenting on the general question, I'm confused about something in your code. How did a proxy get bound to this in your example? On Sun, Jan 20, 2013 at 10:49 AM, Kevin Smith khs4...@gmail.com wrote: Does the stack unwind as with normal error handling? Does after bar get logged?

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread David Bruant
Le 20/01/2013 18:54, Allen Wirfs-Brock a écrit : On Jan 20, 2013, at 3:04 AM, David Bruant wrote: Le 20/01/2013 05:27, Allen Wirfs-Brock a écrit : Weakmaps and symbol keyed properties (private or not) are very different mechanism. They each have a variety of uses and differing

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread David Bruant
Le 20/01/2013 19:01, Brendan Eich a écrit : David Bruant wrote: Once again, the spec (well... you in that case :-) ) will do whatever is necessary to make the feature understandable by spec readers. Transpilers will work with whatever is in the language. If they only have weakmaps, they'll use

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Brendan Eich
Allen Wirfs-Brock wrote: We we were going to talk about adding support for addition semantics to classes we should start at the level of the object model. Not with syntax. ES6 class syntax is good because it is defined in terms of the object model and more basic operations that are defined

Re: redefine.js - A Simplified ES5 Approach

2013-01-20 Thread Andrea Giammarchi
and the blog entry http://webreflection.blogspot.com/2013/01/redefinejs-simplified-es5-approach.htmlthen I swear, I won't bother anymore unless somebody will ask anything or give some feedback :-) thanks On Sat, Jan 19, 2013 at 10:41 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote:

Re: redefine.js - A Simplified ES5 Approach

2013-01-20 Thread Brendan Eich
For defining properties, looks nice and concise. The first bit shows no win over Object.create, IMHO. /be Andrea Giammarchi wrote: and the blog entry http://webreflection.blogspot.com/2013/01/redefinejs-simplified-es5-approach.html then I swear, I won't bother anymore unless somebody will

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Allen Wirfs-Brock
On Jan 20, 2013, at 11:12 AM, David Bruant wrote: Le 20/01/2013 18:54, Allen Wirfs-Brock a écrit : On Jan 20, 2013, at 3:04 AM, David Bruant wrote: Le 20/01/2013 05:27, Allen Wirfs-Brock a écrit : Weakmaps and symbol keyed properties (private or not) are very different mechanism. They

Re: redefine.js - A Simplified ES5 Approach

2013-01-20 Thread Andrea Giammarchi
thanks, I've posted so many links I am not sure what's the first bit but Object.create(proto[, descriptorsList]) is actually redefine.from(proto[, keyValuesList[, descriptorDefaults]]) so that var newInstance = Object.create(null, { name: { value: new Instance }, toString: { value:

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Brendan Eich
Skipping contentious stuff (some of which, e.g. classes as sugar, I agree with -- and so does TC39) to get to this paragraph: Allen Wirfs-Brock wrote: The [[Get]] and [[Set]] (and probably some others) internal methods of a proxy never call the corresponding trap when the property key is a

Re: Proxy questions

2013-01-20 Thread Kevin Smith
Let me correct a typo in that last one: var blackHolePurse = new Purse(); var blackHole = new Proxy(blackHolePurse, { get: function(obj, name) { if (name === somethingInocuous) throw new Error(Up in smoke!); return obj[name]; } }); try {

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Allen Wirfs-Brock
On Jan 20, 2013, at 2:27 PM, Brendan Eich wrote: Skipping contentious stuff (some of which, e.g. classes as sugar, I agree with -- and so does TC39) to get to this paragraph: Allen Wirfs-Brock wrote: The [[Get]] and [[Set]] (and probably some others) internal methods of a proxy never

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Brandon Benvie
Err I take it back. They can be implemented in terms of private symbols, but every access has to be guarded with a hasOwn check which would be observable to a Proxy. On Sunday, January 20, 2013, Brandon Benvie wrote: On Sunday, January 20, 2013, Allen Wirfs-Brock wrote: I'm not sure if you

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Brendan Eich
Allen Wirfs-Brock wrote: Perhaps you're in favor of that in addition? But if so, how would one proxy such that the @@DateValue symbol was the name parameter to get and set traps? I'm not sure if you are getting at something other than what I've described above. If a @@DateValue private

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Allen Wirfs-Brock
On Jan 20, 2013, at 4:42 PM, Brandon Benvie wrote: On Sunday, January 20, 2013, Allen Wirfs-Brock wrote: I'm not sure if you are getting at something other than what I've described above. If a @@DateValue private symbol is actually used as the implementation of [[DateValue]] then

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Allen Wirfs-Brock
On Jan 20, 2013, at 4:46 PM, Brandon Benvie wrote: Err I take it back. They can be implemented in terms of private symbols, but every access has to be guarded with a hasOwn check which would be observable to a Proxy. Well, proxy observability is the topic of discussion. they wouldn't be

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Allen Wirfs-Brock
On Jan 20, 2013, at 5:42 PM, David Bruant wrote: Le 20/01/2013 23:05, Allen Wirfs-Brock a écrit : On Jan 20, 2013, at 11:12 AM, David Bruant wrote: complicated was an expression. Either proxies don't work with class instances, making them vastly pointless or classes need to publicize

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Brandon Benvie
This looks to address the issues. The reason Proxoes would work (it doesn't currently because I opted to switch back to using a regular internal property because of the issue I mentioned) is because getting the date value changes from get internal property value for which Proxies have no specified

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Brandon Benvie
On Sun, Jan 20, 2013 at 10:41 PM, Brendan Eich bren...@mozilla.com wrote: Brandon Benvie wrote: Going to the title of this thread, it's my view that private symbols should just auto-forward to the ultimate target no matter what, Doesn't this allow private symbols to pierce membranes? Or do

Re: Security Demands Simplicity (was: Private Slots)

2013-01-20 Thread Brandon Benvie
Er to clarify, I didn't mean non-proxied. I meant directly forwarded to the target with no possibility of a malfunction or interception by any proxy traps. I want the property forwarded unconditionally, so it has the same guarantees that a regular [[Get]] does (except in the case of revokable

Re: An example of the third basic rule of semicolon insertion

2013-01-20 Thread heathmatlock
V8 and spidermonkey both ignore the third rule: https://gist.github.com/4583287 On Sun, Jan 20, 2013 at 9:47 AM, Kang-Hao (Kenny) Lu kangh...@oupeng.com wrote: (13/01/20 15:07), heathmatlock wrote: Substitute chance for check in the previous email. (I couldn't find your previous mail either