Adding 'promise' as a keyword when it is certainly used as a variable name
throughout many codebases is asking for trouble.

I'd also add that you could use `const promiseFunction = new Promise(res,
rej) { [...] }; `

As Isiah hinted, you can often be much more terse: `const promiseFunction =
Promise.resolve(resValue);`

On Mon, 6 Nov 2017 at 15:23 Jorge Téllez <[email protected]> wrote:

> I would like to propose a new syntax for promises for the next ECMAScript.
>
> It is common to define promises in the following way:
>
> function promiseFunction() {
>   return new Promise(resolve, reject) {
>     resolve(someValue);
>   };
> }
>
> In the previous example, I am declaring a function so that I can access
> the promise throughout.
>
> I would like propose a simpler syntax to remove this redundancy:
>
> promise promiseFunction(resolve, reject) {
>   resolve(someValue);
> }
>
> This will make the promise declaration easier to read in a similar fashion
> as the new class syntax made it easier to declare prototypes.
>
> __
> Jorge Téllez
> +52 1 81 2567 8257 <+52%201%2081%202567%208257>
> @novohispano <http://twitter.com/novohispano>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to