Re: Re: Async Class

2019-08-26 Thread Dimitrian Nine
How it says: "there is no limit to perfection" - [new wrapper][1]. Now it works like more native: ```js class PromiseClass { static async new(test='test'){ this.promise= test; return this;} constructor(...args) { let s = async()=>PromiseClass.new.call(this,...args); return (async r=>await s()

Re: Re: Async Class

2019-08-26 Thread Dimitrian Nine
>Not a bad idea, but I'd strongly prefer the promise to be returned from new >AsyncClass(...) itself instead This about wrapper? He is just example of how functional can work right now. >I do have a preference: async should decorate the constructor, not the class How i say before: both variants

Re: Re: Async Class

2019-08-26 Thread Isiah Meadows
Not a bad idea, but I'd *strongly* prefer the promise to be returned from `new AsyncClass(...)` itself instead. And down that vein, `super` with async classes should also implicitly `await` in its `super` call, setting `this` to the value itself. For sanity reasons, `super` should return a promise

Re: Re: Async Class

2019-08-26 Thread Dimitrian Nine
Ok so much time has passed. I have learned more js. And created some [wrapper][1] for my idea: Class is just function constructor that return object Async Class is async function constructor that returns promise object. Wrapper code: ```js class PromiseClass { //promisified class static async