Re: {this} object literal

2017-04-21 Thread Gary Guo
Because the shorthand requires an Identifer, and an IdentiferName is not sufficient. If the rule allows arbitrary IdentiferName, then we will also allow `{if}`, which makes no sense it all. So if we really want to allow this, it would be a special rule in addition to the current rule. In this

Re: {this} object literal

2017-04-21 Thread Gary Guo
Because the shorthand only requires an Identifer, and an IdentiferName is not sufficient. If the rule allows arbitrary IdentiferName, then we will also allow `{if}`, which makes no sense it all. So if we really want to allow this, it would be a special rule in addition to the current rule. In

RE: Error stack strawman

2016-02-25 Thread Gary Guo
Things became more complicated when considering async & generators. For async calls as mentioned before somewhere in the thread, only Firefox Nightly build includes histories of the frame, while all other browsers don't. It could be useful to include that in stack trace, but it will then be a

RE: Error stack strawman

2016-02-18 Thread Gary Guo
Andreas wrote:> This would be fairly difficult to support by implementations. In V8, for example, we currently have no way of reconstructing that information, nor would it be easy or cheap to add that. A frame is created by the callee, but that does not know how it got

RE: Error stack strawman

2016-02-17 Thread Gary Guo
the function object from the frame? * I wonder if putting special cases in (), such as (native) will cause any problem. No one will have a file called "(native)" in reality, isn't it? Gary Guo Date: Wed, 17 Feb 2016 17:04:39 -0800 Subject: Re: Error stack strawman From: erig...@google.com

RE: Error stack strawman

2016-02-17 Thread Gary Guo
al case, with parenthesis source: 'url', // (native) for native code, with parenthesis line: 'integer', column: 'integer', isTail: 'boolean'}```And null entry indicating crossing realm. BTW, shall we add reference to function in the object representation? Gary Guo

RE: Additional methods for Objects (like Arrays)

2016-01-30 Thread Gary Guo
Not all objects are used as maps, and when using with map we often use `Object.create(null)`, so adding to prototype is definitely a bad idea. As for whether we should make them static methods of Object, I personally don't think this is very useful. Using a for-in loop is enough in my opinion.

RE: JavaScript Language feature Idea

2016-01-25 Thread Gary Guo
I oppose the Symbol approach. It makes code looks ugly just for adding write access. There is already a `.push()`, and we only need to add `.last()` or `.back()` to make it complete. > From: k...@kdex.de > If it comes to write access, I agree that`Symbol.last` could be another > handy >

RE: Error stack strawman

2016-01-25 Thread Gary Guo
I believe a lot of additional work needs to be done for this proposal to make it works across realm. Consider the invocation chain:alpha, alpha0 (in realm A)beta, beta0 (in realm B)alpha -> alpha0 -> beta -> beta0 -> alpha ->alpha0 -> beta -> beta0 -> throws Here comes the question. What should

RE: Error stack strawman

2016-01-25 Thread Gary Guo
One thing needs to be considered as well. What should be displayed for tail calls?___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

RE: Specifying the Existential Operator using Abrupt Completion

2016-01-15 Thread Gary Guo
Note that this can possibly complicate the parser as additional effort is required to distinguish it from conditional expression. From: zenpars...@gmail.com Date: Thu, 14 Jan 2016 15:08:21 + Subject: Re: Specifying the Existential Operator using Abrupt Completion To: claude.pa...@gmail.com;

RE: Object id, hash, etc?

2015-09-08 Thread Gary Guo
Changing toString() is obviously not possible since the semantics are fixed and many existing code depends them (ex. Object.prototype.toString are used for type identifying, String.prototype.toString are used for meta-programming frameworks. I think you can extend Object.prototype to provide a

RE: Weak References

2015-09-06 Thread Gary Guo
I think weak references are discussed before, and get postponed because it can cause information leaks between realms. From: isiahmead...@gmail.com Date: Sat, 5 Sep 2015 07:07:40 -0400 Subject: Weak References To: es-discuss@mozilla.org I'm resurrecting this [1] because I have found a use case

RE: Named Paramters

2015-07-12 Thread Gary Guo
If we really need this, you may want to use colon to replace the assignment operator in your example. foo(bar: 5) ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

RE: Allow `try…catch` blocks to return a value.

2015-07-12 Thread Gary Guo
This is not possible as it contracts with existing semantics. Wrap it with a function instead. From: jbuca...@me.com Subject: Allow `try…catch` blocks to return a value. Date: Sun, 12 Jul 2015 06:53:52 +0900 To: es-discuss@mozilla.org Allow `try…catch` blocks to return a value.Sometimes I wrap

IteratorClose on spread expression

2015-06-23 Thread Gary Guo
To me it seems that spread expression will not call IteratorClose (neither in ArrayLiteral nor in Argument List), but IteratorClose is called in other places in the spec where iterators are used, ex. for-of, destructuring, builtin functions). Is this intended or this is a bug in the spec? Gary

RE: revive let blocks

2015-06-18 Thread Gary Guo
Be aware that the way you utilize 'let' will be a breaking change. In ES5 and ES6```let(a=1) {}```is valid and it is a call to let with one argument followed by a block. Your suggestions will turn it into a let-block. In ES6 let is considered as an identifier and the meaning is created by

RE: Consider javascript already support for default parameters, so maybe we can use the default parameter to specify the strong type.

2015-05-20 Thread Gary Guo
If strong type is needed, why not use TypeScript? From: luoyongg...@gmail.com Date: Mon, 18 May 2015 01:50:34 +0800 Subject: Consider javascript already support for default parameters, so maybe we can use the default parameter to specify the strong type. To: es-discuss@mozilla.org For

RE: Supporting feature tests directly

2015-03-22 Thread Gary Guo
So why not just add a sandbox, and let uncertificated codes run in the sandbox, providing the external environment means to catch error (or interact somehow) ___ es-discuss mailing list es-discuss@mozilla.org

RE: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-21 Thread Gary Guo
To me I would like it to be reverted for back-compatiblity. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

RE: Add String.prototype[@@toStringTag] and other pre-ES6 constructors' toStringTag property

2015-02-17 Thread Gary Guo
, `Boolean.prototype.valueOf.call` (and the same for all the others). I think that the only way that Object#toString.call should return X by default is if the item is actually a X, which X.prototype no longer is (for the values of X in question). On Fri, Feb 13, 2015 at 8:09 PM, Gary Guo nbdd0...@hotmail.com

RE: TemplateLiteral tagged with super

2015-02-13 Thread Gary Guo
If super TemplateLiteral is added, I will suggest we add new MemberExpression TemplateLiteral, which might be more useful in practice. Date: Fri, 13 Feb 2015 20:55:49 -0500 Subject: Re: TemplateLiteral tagged with super From: zenpars...@gmail.com To: al...@wirfs-brock.com CC:

RE: Proposal: No LineTerminator should be allowed between {CallExpression, MemberExpression} TemplateLiteral

2015-02-13 Thread Gary Guo
Good observation. I agree. Date: Fri, 13 Feb 2015 15:39:29 -0800 Subject: Proposal: No LineTerminator should be allowed between {CallExpression, MemberExpression} TemplateLiteral From: ikariena...@gmail.com To: es-discuss@mozilla.org The connection between a CallExpression/MemberExpression and

RE: @@toStringTag spoofing for null and undefined

2015-02-11 Thread Gary Guo
Oops I just click reply instead of reply all. Sorry for that. The point I am trying to make is that they still work, because legacy code assumes {}.toString.call(String.prototype) returns [object String]. The only possible incompatibility is the change of String.prototype, from itself a String

RE: @@toStringTag spoofing for null and undefined

2015-02-10 Thread Gary Guo
`({[Symbol.toStringTag]: 'String'})` could be identified as string as well, use the legacy method. ES6 guarantees that legacy code will work, but it does not ensure that legacy code could work well with new codes that intended to create a fake string. Subject: Re: @@toStringTag spoofing for

RE: Property names for public symbols

2015-02-09 Thread Gary Guo
How about classTag instead of toStringTag, which makes it sound like a noun. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

RE: @@toStringTag spoofing for null and undefined

2015-02-09 Thread Gary Guo
09:34:30 -0800 CC: es-discuss@mozilla.org To: nbdd0...@hotmail.com On Feb 8, 2015, at 5:35 AM, Gary Guo wrote:No one have comments on this? See the latest (Feb 2) spec. revision: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring

RE: @@toStringTag spoofing for null and undefined

2015-02-09 Thread Gary Guo
:43:23 +0100 CC: al...@wirfs-brock.com; es-discuss@mozilla.org To: nbdd0...@hotmail.com Le 9 févr. 2015 à 16:15, Gary Guo nbdd0...@hotmail.com a écrit :I propose addition of String.prototype[@@toStringTag] as well as abridgement of Object.prototype.toString. The issue with that approach

RE: @@toStringTag spoofing for null and undefined

2015-02-08 Thread Gary Guo
No one have comments on this? From: nbdd0...@hotmail.com To: ljh...@gmail.com Subject: Re: @@toStringTag spoofing for null and undefined Date: Sat, 31 Jan 2015 06:03:17 + CC: es-discuss@mozilla.org Are the checks for these internal slots continuing to exist? Or shall we

Re: Property names for public symbols

2015-02-06 Thread Gary Guo
Probably too late, since ther is already implementations starting implementing them, what's more, I think constant are not necessarily uppercase - we should not apply convention of C on ECMAScript. To me it is reasonable to use lowercase. ___ es-discuss

Re: export default and export {foo as default}?

2015-01-30 Thread Gary Guo
In fact regarding `export default foo` and `export {foo as default}` as equivalent is current the practice of traceur.___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: The enumerate trap and Object.create()

2015-01-30 Thread Gary Guo
Seems a serious problem, but could be easily fixed (I think). For Example, this could be used as [[Enumerate]] for ordinary objects: 9.1.11 [[Enumerate]]([visitedSet]) When the [[Enumerate]] internal method of O and optional argument visitedSet is called the following steps are taken Return

Re: @@toStringTag spoofing for null and undefined

2015-01-30 Thread Gary Guo
Are the checks for these internal slots continuing to exist? Or shall we just set the @@toStringTag on their prototype and drop these steps. For example: If the this value is undefined, return [object Undefined]. If the this value is null, return [object Null]. If O has an [[ParameterMap]]

RE: @@toStringTag spoofing for null and undefined

2015-01-24 Thread Gary Guo
Now I have a tendency to support the suggestion that cuts the anti-spoofing part. If coder wants to make an object and pretend it's a built-in, let it be. The anti-spoofing algorithm could not prevent this case:```Object.prototype.toString = function(){ return '[object

RE: @@toStringTag spoofing for null and undefined

2015-01-20 Thread Gary Guo
Agree with Allen. As long as we can prevent spoofing for string, number, etc (ES5 defined), we should leave others as is, otherwise people may argue that Map, WeakMap, etc should be unspoofable as well. ___

RE: escaping - in /u RegExp

2015-01-13 Thread Gary Guo
I think it s a bug, and I think your proposal is appropriate. From: al...@wirfs-brock.com Subject: escaping - in /u RegExp Date: Tue, 13 Jan 2015 13:23:54 -0800 To: es-discuss@mozilla.org Would those of you who consider yourselves RegExp experts take a look at

RE: Sharing a JavaScript implementation across realms

2015-01-13 Thread Gary Guo
I don't think there is any difference in self-hosting JavaScript or JS-engine in C++. For example, use the example case `Array.prototype.map`, in C++, we could code a native function and create a corresponding object for each realm (note that the only shared part is the native function). In

RE: (x) = {foo: bar}

2015-01-07 Thread Gary Guo
Even when we want to throw early errors for object-literal-like block, I consider my argument still valid. ```()={ method() { }}```Should we throw an early error? Of course not, but it might be a potential error; out task is not to warn on object-literal-like block; instead, maybe simply we

RE: (x) = {foo: bar}

2015-01-06 Thread Gary Guo
returns 1. From: a...@kocharin.ru To: nbdd0...@hotmail.com; bren...@mozilla.org CC: es-discuss@mozilla.org Subject: Re: (x) = {foo: bar} Date: Tue, 6 Jan 2015 06:59:52 +0300 06.01.2015, 06:38, Gary Guo nbdd0...@hotmail.com: Though I am strongly negative, but there actually

RE: (x) = {foo: bar}

2015-01-06 Thread Gary Guo
I found that even without shorthand, the object literal can still be ambiguous with block. ```js()={ method() { }} shall it be interpreted as()=({ method(){// method body }}) or ()={ method(); {// block statement }}``` This is certainly an ambiguity that cannot be resolved by

RE: (x) = {foo: bar}

2015-01-05 Thread Gary Guo
Strongly negative against the proposal. I believe that charisma of a language comes from its simplicity. The proposal seems to add too many syntax rules to ES. btw it is not easy to implement such a syntax into practice. I'm afraid there will be more syntax refinement, which actually make the

RE: generator libraries

2015-01-04 Thread Gary Guo
Actually I wrote pretty much the similar one with less functions (since I haven't need to use them yet), but with different name (I use Stream, since my idea are simply from Java 8's Stream AI)

RE: Overriding the == operator, like in Java/Lua/Python/whatever.

2015-01-04 Thread Gary Guo
I agree that use equals is a better choice. If operator overloading is implemented, you may experience inconsistency (different instance of builtin boxed values would be unequal according to default semantics, while after overloaded == operator it becomes equal.) Date: Sat, 3 Jan 2015 23:52:58

RE: Overriding the == operator, like in Java/Lua/Python/whatever.

2015-01-04 Thread Gary Guo
I agree that use equals is a better choice. If operator overloading is implemented, you may experience inconsistency (different instance of builtin boxed values would be unequal according to default semantics, while after overloaded == operator it becomes equal.) Date: Sat, 3 Jan 2015 23:52:58

RE: Can `let`, `static` and `yield` still be used as Identifier?

2015-01-02 Thread Gary Guo
Subject: Re: Can `let`, `static` and `yield` still be used as Identifier? To: nbdd0...@hotmail.com CC: es-discuss@mozilla.org On Thu Jan 01 2015 at 9:47:47 PM Gary Guo nbdd0...@hotmail.com wrote: It seems that in JSFiddle running on Firefox, let declaration is disabled. So this cannot explain

RE: Why does Symbol.for and Symbol.keyFor are limited to strings?

2015-01-02 Thread Gary Guo
Why not? Symbol's [[Description]] internal slot is string Date: Fri, 2 Jan 2015 18:18:55 +0100 Subject: Why does Symbol.for and Symbol.keyFor are limited to strings? From: michalwa...@gmail.com To: es-discuss@mozilla.org What is reason behind restricting entries in global symbol registry

RE: Can `let`, `static` and `yield` still be used as Identifier?

2015-01-01 Thread Gary Guo
It seems that in JSFiddle running on Firefox, let declaration is disabled. So this cannot explain. From: waldron.r...@gmail.com Date: Wed, 31 Dec 2014 21:36:46 + Subject: Re: Can `let`, `static` and `yield` still be used as Identifier? To: a...@kocharin.ru; erik.arvids...@gmail.com;

Can `let`, `static` and `yield` still be used as Identifier?

2014-12-29 Thread Gary Guo
From the specification I saw `yield` is being explicitly declared as an possible Identifier in non-strict mode, and there `let`, `static` are parsed as identifier first. However, I did not see anyway to distinguish `let` identifier and `let` keyword. `let=1` is parsed as illegal in traceur, and

RE: Throwing when symbol *wrappers* are converted to primitives

2014-12-27 Thread Gary Guo
The first one makes no sense to me, since a symbol can be used as a property key. The latter one makes sense but the error should be Cannot convert a Symbol value to a string. From: a...@rauschma.de Date: Sat, 27 Dec 2014 08:17:40 +0100 Both exceptions make a lot of sense, but I don’t see that

RE: Elegant way to generate string from tagged template?

2014-12-23 Thread Gary Guo
From: curvedm...@gmail.com Date: Tue, 23 Dec 2014 14:55:57 +0800 Given an array of [1,2,3] and other array of [“a”,”b”], it should return [1,”a”,2,“b”,3]. (probably a lot of edge cases to cover, but just ignore them for now). It is not a hard task. I don't think we need to add it into the

RE: Elegant way to generate string from tagged template?

2014-12-23 Thread Gary Guo
From: curvedm...@gmail.com Date: Tue, 23 Dec 2014 14:55:57 +0800 Given an array of [1,2,3] and other array of [“a”,”b”], it should return [1,”a”,2,“b”,3]. (probably a lot of edge cases to cover, but just ignore them for now). I came up with an idea. Symmetric to String.raw, we can have a

RE: classes and enumerability

2014-12-23 Thread Gary Guo
I would say enumerate through classes' or instances' properties are a strange use and should be discouraged. I would prefer nothing but instance properties to be enumerable. To me, it is illogical for methods to be enumerable.

RE: classes and enumerability

2014-12-23 Thread Gary Guo
Object.defineProperty could easily do that. From: curvedm...@gmail.com Date: Wed, 24 Dec 2014 13:33:24 +0800 Although I guess it’s not very easy to desugar to es5 if there is no way to enumerate prototype methods/properties. (probably impossible?)

RE: Array.forEach() et al with additional parameters

2014-12-22 Thread Gary Guo
On Mon, 22 Dec 2014 11:37:04 +0100, David Bruant bruan...@gmail.com wrote:Function.prototype.bindParameter = function(...args){ return this.bind(undefined, ...args) } But this will bind all parameters. In Christian Mayer's situation, she wants first three parameters unbound while your

RE: Will `for (var a of null) {}` throw an error?

2014-12-22 Thread Gary Guo
On Mon, 22 Dec 2014 21:06:18 +0800, Glen Huang curvedm...@gmail.com wrote:Ideally it shouldn’t, because its twin `for (var a in null) {}` won’t. But looking at step 8 in

RE: Will `for (var a of null) {}` throw an error?

2014-12-22 Thread Gary Guo
Actually I propose a change in texts in the specification. CheckIterable ( obj )1. If obj is `undefined` or `null`, then return `undefined`.2. If type(obj) is Object, then return Get(obj, @@iterator).3. Let box be ToObject(obj).4. ReturnIfAbrupt(box).5. Return the result of calling the

RE: Will `for (var a of null) {}` throw an error?

2014-12-22 Thread Gary Guo
Date: Mon, 22 Dec 2014 21:28:54 -0800 From: bren...@mozilla.org Your suggestion breaks Array.from and TypedArrayFrom. In the spec: 8. Let arrayLike be ToObject(items). A type error will also be thrown since null and undefined are not ObjectCoercible.

RE: Proposal About Private Symbol

2014-12-21 Thread Gary Guo
From: jackalm...@gmail.com Date: Sun, 21 Dec 2014 00:45:40 -0800 There are ways around this, too - create your own Symbol, keep it closure-private to the class, so it doesn't escape the class's methods. Have the constructor take an extra argument that must be equal to this symbol; if it's

RE: Proposal About Private Symbol

2014-12-21 Thread Gary Guo
Oops, I forget the WeakSet. So seems my private symbol proposal can work now. Under very deliberately design, private symbol can be used as private field. ```jsvar constructor=function(){'use strict';var allObjects=new WeakSet();var privateSymbol=Symbol('private', true);var

RE: Add Reflect.isConstructor and Reflect.isCallable?

2014-12-21 Thread Gary Guo
If added, it can help ES engines to write more code in ES instead of native languages. So +1 as well. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

RE: Array.forEach() et al with additional parameters

2014-12-20 Thread Gary Guo
I think extending standard libraries/functions is not the most elegant approach. I think what you suggest is basically trying to bind some parameter that isn't the first few continuous parameter (in this case, it is the 4th parameter) while keeping the first few parameter unbound. I believe

Proposal About Private Symbol

2014-12-20 Thread Gary Guo
I have just sent this proposal through http://www.ecma-international.org/memento/register_TC39_Royalty_Free_Task_Group.php but I don't know what more I need to do. I am a high school student from China who is interested in next-generation ecmascript and has been working on an ecmascript

Re: Re: descriptors and not only own properties gotcha

2014-12-20 Thread Gary Guo
On Wed Dec 17 10:30:03 PST 2014, Andrea Giammarchi wrote: This would already fix the `Object.prototype.get` or `.set` case since I believe nobody ever used an inherited `value` property on purpose for descriptors ... or is it? I agree that nobody will use an inherited 'value' property, however,

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
I don't think it's a problem though. As long as the private Symbol doesn't leak, there is no way to access private properties. Private Symbol as I supposed only eliminate itself from getOwnPropertySymbols, and that's it,nbsp;there should not be no morenbsp;constraintsnbsp;on private

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
Oops, seems Outlook.com ruins my email. One more time I don't think it's a problem though. As long as the private Symbol doesn't leak, there is no way to access private properties. Private Symbol as I supposed only eliminate itself from getOwnPropertySymbols, and that's it, there should not

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
One link there are 4 assumptions about private symbol, while I think the existence of first one is sufficient. 1. They would not be discoverable by Object.getOwnPropertySymbols This is what I suggest. 2. They would not invoke any traps on proxies. 3. They would not tunnel through proxies to

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
Technically speaking there is no way to prevent such a attack, since in the debugger everything can be exposed to external environment. Careful check is still needed with private symbols according to my proposal. ```js var constructor=function(){     'use strict';     var sym=Symbol('private',

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
Oops, mistakes found. I just ignored the fact that in this particular way the Symbol can be retrieved. It seems impossible to have an idea of private symbol in this way. In the case, I think the language can provide a way to distinguish whether an object is created directly by a