Syntax to pick named exports from a module

2017-02-21 Thread Gray Zhang
-- Gray Zhang ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Subclassing native class and instanceof operator

2016-05-31 Thread Gray Zhang
ub.io/compat-table/es6/ under "Subclassing" to see if > your browser supports subclassing builtins yet. > > On Mon, May 30, 2016 at 11:32 PM, Gray Zhang <otakus...@gmail.com> wrote: > >> Recently I encountered an issue about subclassing Error and instance >>

Subclassing native class and instanceof operator

2016-05-31 Thread Gray Zhang
Recently I encountered an issue about subclassing Error and instance operator, my simplified code is: ``` class MyError extends Error { constructor() { super('my error'); } } let error = new MyError(); console.log(error instanceof MyError); console.log(error.constructor); ```

How about a "named true" and a "named true property"

2016-05-26 Thread Gray Zhang
I don't really know how to name this feature, but I find it quite neccessary In JavaScript land there are many functions with parameters of type boolean, and invocations to these functions do not have high readability, for example jQuery have a `clone` method with a parameter deep of type

Re: When should we define a function as async

2015-06-03 Thread Gray Zhang
is a promise or not Anyway this is not an issue about spec itself, it’s more like an open discussion, thanks for reply :) Best regards Gray Zhang 在 2015年6月3日 下午4:18:14, Gruenaum Benjamin (benjami...@gmail.com) 写到: A function needs to be defined `async` if you intend to possibly use the await

When should we define a function as async

2015-06-02 Thread Gray Zhang
cases to eliminate then calls? Best regards Gray Zhang ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Maybe we need a reflect API to iterate over instance members

2015-06-01 Thread Gray Zhang
API is not suitable to provide such functionality? Best regards Gray Zhang 在 2015年6月1日 下午12:52:26, Fink Steve (sph...@gmail.com) 写到: Forgive me for golfing it, but function getAllPropertyNames(o) {     if (!o) return [];     return Object.getOwnPropertyNames(o) + getAllPropertyNames

Re: Maybe we need a reflect API to iterate over instance members

2015-05-31 Thread Gray Zhang
Not exactly Reflect.ownKeys does not walk up prototype chain so it does not return inherited members Reflect.enumerate seems not return non-enumerable members What I propose is an API that returns both non-enumerable and inherited members Best regards Gray Zhang 在 2015年6月1日 上午1:15:58

Maybe we need a reflect API to iterate over instance members

2015-05-31 Thread Gray Zhang
regards Gray Zhang ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Class decorators and async process

2015-05-23 Thread Gray Zhang
Hi all: I’m wondering if there is any way to combine a class decorator and an async process together? A common case would be a generic IoC implementation: Since in JavaScript IoC we load runtime modules async by a config file, the interface may be: {Promise} ioc.getComponent({string}

Re: Class decorators and async process

2015-05-23 Thread Gray Zhang
idea based on extended property descriptors actually being used, e.g., with Babel? Sorry if I missed it. Decorator is now supported with Babel 5.0 and I was trying this these days, expecting it could be integrated with our IoC framework, just as how Spring works in Java. Best regards Gray Zhang

Re: Cancellation architectural observations

2015-03-02 Thread Gray Zhang
regards Gray Zhang 在 2015年3月2日 下午7:26:52, Gundersen Marius (gunder...@gmail.com) 写到: I think a better term than cancel would be ignore. If the promise has side effects then it is impossible for a cancel method to guarantee that the side effects do not happen. For example a POST request

Should I use resolve reject in a yes-or-no scenario

2015-02-01 Thread Gray Zhang
Recently I was reviewing my code repository and the useless of Promise, I found we have majorly 2 scenario to use Promise: Just match the synchronous flow control, so then matches return and catch  matches catch Use it for a yes-or-no scenario, this is what I’m confusing For the 2nd scenario, a

RE: Should I use resolve reject in a yes-or-no scenario

2015-02-01 Thread Gray Zhang
or reject), is there any potential side effect to create a never-fulfilled promise? Thanks Best regards Gray Zhang 在 2015年2月2日 上午5:46:17, de la Puente González Salvador (sa...@unoyunodiez.com) 写到: From my point of view, rejection is the way to communicate out-of-domain values. So

Re: Native JSON loading (was: system module loader)

2012-03-15 Thread Gray Zhang
(The stop-point in code example), then close this connection (or other ways to notify server that remaining content is not required), this would (in some case) be benefit for network performance. Gray Zhang Mail: otakus...@gmail.com Blog: http://www.otakustay.com Weibo: http://www.weibo.com