Re: Cross-global instanceof

2013-11-01 Thread Andrea Giammarchi
Sure, so Allen asked me a real case to show, and I've done it. Now you please show me a real case when you pass a revival function to `JSON.parse` that is from another realm, explaining why, as I've done for mine, thanks. Best Regards On Thu, Oct 31, 2013 at 7:41 PM, Oliver Hunt

Re: Cross-global instanceof

2013-11-01 Thread Andrea Giammarchi
also, your reviver would receive objects from the realm I am checking with that code ... so your reviver will receive object from the **expected** realm ... just to clarify, for future readers. Still all ears listening to that case I've never, honestly, considered! Thanks On Thu, Oct 31, 2013

Re: Cross-global instanceof

2013-11-01 Thread Oliver Hunt
On Nov 1, 2013, at 7:23 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: also, your reviver would receive objects from the realm I am checking with that code ... so your reviver will receive object from the **expected** realm ... just to clarify, for future readers. I don’t

Re: ES6 Timeline

2013-11-01 Thread Juriy Zaytsev
Finalized spec or finalized implementations? A lot of things are already being implemented (with varying levels of conformance, of course) in latest versions of engines (from browsers to node) — http://kangax.github.io/es5-compat-table/es6/ -- kangax On Fri, Nov 1, 2013 at 5:02 AM, Nathan

Re: Modules loader define method

2013-11-01 Thread Guy Bedford
Surely this can be dealt with by extending the CSP policy to allow script domains which are able to call System.define. Surely it is an equivalent permission to being able to load script from the domain anyway, when it is restricted to running in the outer scope only? On 31 October 2013 16:10,

RE: ES6 Timeline

2013-11-01 Thread Nathan Wall
Finalized spec or finalized implementations?  A lot of things are already being implemented (with varying levels of conformance, of course) in latest versions of engines (from browsers to node) — http://kangax.github.io/es5-compat-table/es6/ -- kangax Yes, thanks, I'm aware of

Re: ES6 Timeline

2013-11-01 Thread Rick Waldron
On Fri, Nov 1, 2013 at 12:02 AM, Nathan Wall nathan.w...@live.com wrote: Hey guys, I really think you're all doing an awesome job with the development of the future of the language, especially all the work Allen's putting into the drafts. I'm really dying to start using some of these

Re: Modules loader define method

2013-11-01 Thread Erik Arvidsson
I think I must be missing something? On Fri, Nov 1, 2013 at 6:47 AM, Guy Bedford guybedf...@googlemail.comwrote: Surely this can be dealt with by extending the CSP policy to allow script domains which are able to call System.define. How is that different to extending the CSP policy to allow

Re: Modules: import *

2013-11-01 Thread Jason Orendorff
On Thu, Oct 31, 2013 at 12:40 PM, Erik Arvidsson erik.arvids...@gmail.com wrote: On Thu, Oct 31, 2013 at 1:22 PM, Jason Orendorff jason.orendo...@gmail.com wrote: import * from stickers; ... y = r * Math.sin(a); ... It is unclear whether `Math` refers to the global Math

Re: Module: export *

2013-11-01 Thread Sam Tobin-Hochstadt
On Thu, Oct 31, 2013 at 11:06 AM, Erik Arvidsson erik.arvids...@gmail.com wrote: Make sense but I'm not sure it is needed/desired. It's very useful for convenience libraries, quick refactorings, etc. In other languages, I use it a lot. Where is this documented? It's very briefly described in

Re: Modules loader define method

2013-11-01 Thread Guy Bedford
I suppose I am hypothesising that it might be possible to limit the invocation to the outer scope only in some CSP mode. // allowed: System.define(['some-module'], ['export var q = p;']); // not allowed: (function() { System.define(['some-module'], ['export var q = p;']); })(); In this way,

Re: ES6 Timeline

2013-11-01 Thread Allen Wirfs-Brock
On Nov 1, 2013, at 6:23 AM, Rick Waldron wrote: On Fri, Nov 1, 2013 at 12:02 AM, Nathan Wall nathan.w...@live.com wrote: Hey guys, I really think you're all doing an awesome job with the development of the future of the language, especially all the work Allen's putting into the drafts.

Re: ES6 Timeline

2013-11-01 Thread Brian Di Palma
Thanks Rick, From my reading of that schedule we could hope to have ES6 features like modules and classes ready for use in production code (via something like traceur) by Q1 next year? The June/July/Dec 2014 dates are simply dot the i's and cross the t's milestones, standardisation bureaucracy?

Re: ES6 Timeline

2013-11-01 Thread Brian Di Palma
On Fri, Nov 1, 2013 at 3:55 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: There is still plenty of work to do to reach the Ecma standard stage in Dec 2014, but from a feature perspective ES6 should be done within the next 3 months. Excellent news, thanks for the summary.

Re: Cross-global instanceof

2013-11-01 Thread Andrea Giammarchi
I have no idea who is doing that and why but yes, in that case I would never have used instanceof so my example is still valid as use case itself. Cheers On Thu, Oct 31, 2013 at 11:54 PM, Oliver Hunt oli...@apple.com wrote: On Nov 1, 2013, at 7:23 PM, Andrea Giammarchi

Re: Cross-global instanceof

2013-11-01 Thread Anne van Kesteren
On Fri, Nov 1, 2013 at 12:50 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: [isSpecialString]() {return isSpecialString in this}; So this is basically what we have for DOM objects right now. And what we're asking for is having this elevated to language-supported construct. Be it in the form

Re: Modules loader define method

2013-11-01 Thread James Burke
On Thu, Oct 31, 2013 at 8:32 PM, Jeff Morrison lbljef...@gmail.com wrote: Throwing this out there while I stew on the pros/cons of it (so others can as well): I wonder how terrible it would be to have this API define module bodies in terms of a passed function that, say, accepted and/or

Re: Cross-global instanceof

2013-11-01 Thread Allen Wirfs-Brock
On Nov 1, 2013, at 10:40 AM, Anne van Kesteren wrote: On Fri, Nov 1, 2013 at 12:50 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: [isSpecialString]() {return isSpecialString in this}; So this is basically what we have for DOM objects right now. And what we're asking for is having this

Re: Modules loader define method

2013-11-01 Thread Erik Arvidsson
If we limit `module 'm' { ... }` to Script then we still keep the flat module hierarchy. On Nov 1, 2013 2:32 PM, James Burke jrbu...@gmail.com wrote: On Thu, Oct 31, 2013 at 8:32 PM, Jeff Morrison lbljef...@gmail.com wrote: Throwing this out there while I stew on the pros/cons of it (so

Re: Cross-global instanceof

2013-11-01 Thread Andrea Giammarchi
Allen I think we all agree duck typing is more flexible, powerful, easy, etc etc ... but since you mentioned, how would do distinguish between a `Map` and a `WeakMap` without passing through the branding check ? That's a very good example indeed, `'has' in obj` or `'set' in obj` does not grant

Re: Cross-global instanceof

2013-11-01 Thread Mark S. Miller
On Fri, Nov 1, 2013 at 12:16 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Allen I think we all agree duck typing is more flexible, powerful, easy, etc etc ... but since you mentioned, how would do distinguish between a `Map` and a `WeakMap` without passing through the branding

Re: Cross-global instanceof

2013-11-01 Thread Andrea Giammarchi
Thanks Mark, so how is anyone supposed to be sure about or check a Brand in ES6 then? On Fri, Nov 1, 2013 at 1:00 PM, Mark S. Miller erig...@google.com wrote: On Fri, Nov 1, 2013 at 12:16 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Allen I think we all agree duck typing

Re: Modules loader define method

2013-11-01 Thread Jeff Morrison
On 11/1/13, 11:32 AM, James Burke wrote: On Thu, Oct 31, 2013 at 8:32 PM, Jeff Morrison lbljef...@gmail.com wrote: Throwing this out there while I stew on the pros/cons of it (so others can as well): I wonder how terrible it would be to have this API define module bodies in terms of a passed

Re: Cross-global instanceof

2013-11-01 Thread Mark S. Miller
For the ES6 builtin types, I have no idea. For abstractions you define yourself, your abstraction can brand its objects using an encapsulated WeakSet or WeakMap. This will work, but with two problems: * Awkward syntax until more directly supported by ES7 relationships. * Sucky performance until

Re: Cross-global instanceof

2013-11-01 Thread Mark Miller
http://wiki.ecmascript.org/doku.php?id=strawman:relationships On Fri, Nov 1, 2013 at 1:11 PM, Mark S. Miller erig...@google.com wrote: For the ES6 builtin types, I have no idea. For abstractions you define yourself, your abstraction can brand its objects using an encapsulated WeakSet or

Re: Modules loader define method

2013-11-01 Thread James Burke
On Fri, Nov 1, 2013 at 1:04 PM, Jeff Morrison lbljef...@gmail.com wrote: No, that's why I said the function generates an instance of a Module object imperatively (we're already in imperative definition land with this API anyway). No need for `import` or `export` My understanding is that there

Re: Modules loader define method

2013-11-01 Thread Brandon Benvie
On 11/1/2013 1:28 PM, James Burke wrote: Perhaps you know how a mutable slot could be expressed using existing syntax for creating Module objects? Illustrating how would clear up a big disconnect for me. If I'm understanding what you mean by mutable slot, the only way it can be expressed

Re: Modules loader define method

2013-11-01 Thread Jeff Morrison
(I'm operating on the assumption that the Module constructor is still part of the spec): ``` System.define({ A: { deps: ['B','C'], factory: function(B, C) { var stuff = B.doSomething(); return new Module({stuff: stuff}); } }, B: { deps: ['D', 'E'], factory:

Re: Cross-global instanceof

2013-11-01 Thread Allen Wirfs-Brock
On Nov 1, 2013, at 12:16 PM, Andrea Giammarchi wrote: Allen I think we all agree duck typing is more flexible, powerful, easy, etc etc ... but since you mentioned, how would do distinguish between a `Map` and a `WeakMap` without passing through the branding check ? That's a very good

Re: Cross-global instanceof

2013-11-01 Thread Allen Wirfs-Brock
On Nov 1, 2013, at 1:11 PM, Mark S. Miller wrote: For the ES6 builtin types, I have no idea. Most branded ES6 built-ins have non-destructive brand-checking methods that call be used to perform brand checks. For example, function isMap(obj) { try {Map.prototype.size.call(obj);

Re: Modules loader define method

2013-11-01 Thread James Burke
On Fri, Nov 1, 2013 at 2:19 PM, Jeff Morrison lbljef...@gmail.com wrote: (I'm operating on the assumption that the Module constructor is still part of the spec): ``` System.define({ A: { deps: ['B','C'], factory: function(B, C) { var stuff = B.doSomething(); return

Re: Cross-global instanceof

2013-11-01 Thread Mark S. Miller
On Fri, Nov 1, 2013 at 4:03 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Nov 1, 2013, at 12:16 PM, Andrea Giammarchi wrote: Allen I think we all agree duck typing is more flexible, powerful, easy, etc etc ... but since you mentioned, how would do distinguish between a `Map` and a

Re: Cross-global instanceof

2013-11-01 Thread Brandon Benvie
On 11/1/2013 4:29 PM, Mark S. Miller wrote: Hi Allen, perhaps I misunderstood. But I thought that as of ES6, O.p.toString can't be used for reliable brand checking of anything, including legacy ES=5 built-ins. Not so? How would I do such a check of a legacy built-in in ES6? In the spec for

Re: Cross-global instanceof

2013-11-01 Thread Mark S. Miller
I just read https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring and agree that it continues to preserve the brand checks that were reliable in ES5. Cool! Thanks! On Fri, Nov 1, 2013 at 4:31 PM, Brandon Benvie bben...@mozilla.com wrote: On 11/1/2013 4:29 PM,

Re: Cross-global instanceof

2013-11-01 Thread Brandon Benvie
On 11/1/2013 4:31 PM, Brandon Benvie wrote: In the spec for Object.prototype.toString: 'If tag is any of Arguments, Array, Boolean, Date, Error, Function, Number, RegExp, or String and SameValue(tag, builtinTag) is false, then let tag be the string value ~ concatenated with the current value

Re: Cross-global instanceof

2013-11-01 Thread Brandon Benvie
On 11/1/2013 4:59 PM, Brandon Benvie wrote: On 11/1/2013 4:31 PM, Brandon Benvie wrote: In the spec for Object.prototype.toString: 'If tag is any of Arguments, Array, Boolean, Date, Error, Function, Number, RegExp, or String and SameValue(tag, builtinTag) is false, then let tag be the string

Re: Cross-global instanceof

2013-11-01 Thread David Bruant
Le 02/11/2013 01:08, Brandon Benvie a écrit : On 11/1/2013 4:59 PM, Brandon Benvie wrote: On 11/1/2013 4:31 PM, Brandon Benvie wrote: In the spec for Object.prototype.toString: 'If tag is any of Arguments, Array, Boolean, Date, Error, Function, Number, RegExp, or String and SameValue(tag,

Re: Modules loader define method

2013-11-01 Thread David Herman
On Oct 31, 2013, at 7:10 AM, Erik Arvidsson erik.arvids...@gmail.com wrote: I see that Jason added a Loader.prototype.define to his reference implementation. https://people.mozilla.org/~jorendorff/js-loaders/Loader.html#section-177. This is great. It is a much needed capability to allow

Re: Modules: import *

2013-11-01 Thread David Herman
On Nov 1, 2013, at 7:44 AM, Jason Orendorff jason.orendo...@gmail.com wrote: Now... good use cases could be a sufficient counterargument to all this. Maybe we should add `import * from` in 2014. I just want to make it totally clear why it's designed this way for ES6. `import * from` poses

Re: Modules: import *

2013-11-01 Thread David Herman
On Nov 1, 2013, at 6:19 PM, David Herman dher...@mozilla.com wrote: On Nov 1, 2013, at 7:44 AM, Jason Orendorff jason.orendo...@gmail.com wrote: Now... good use cases could be a sufficient counterargument to all this. Maybe we should add `import * from` in 2014. I just want to make it

Re: Cross-global instanceof

2013-11-01 Thread Brandon Benvie
On 11/1/2013 7:13 PM, Allen Wirfs-Brock wrote: Or we could simply not special case Proxy exotic objects and then Proxies would be handled like any other object, the value of the objects @@toStringTag property would be accessed and used to compose the toString result. Which would result in

Re: Cross-global instanceof

2013-11-01 Thread Allen Wirfs-Brock
On Nov 1, 2013, at 7:27 PM, Brandon Benvie wrote: On 11/1/2013 7:13 PM, Allen Wirfs-Brock wrote: Or we could simply not special case Proxy exotic objects and then Proxies would be handled like any other object, the value of the objects @@toStringTag property would be accessed and used to

Re: Module: export *

2013-11-01 Thread David Herman
On Oct 31, 2013, at 8:06 AM, Erik Arvidsson erik.arvids...@gmail.com wrote: Make sense but I'm not sure it is needed/desired. I agree, actually, despite being the one who put it in there in the first place. I originally intended it as a convenience e.g. for quick scripts. But by itself it's

Re: Cross-global instanceof

2013-11-01 Thread Brandon Benvie
On 11/1/2013 8:54 PM, Allen Wirfs-Brock wrote: This just reminds me how cold I still am on the fact that you can't easily one-off Proxy anything that's not a plain Object, Array, or Function because of the lack of an invoke trap and every other type of built-in has private state... but I