That is for returning values of arrays (or slightly changed values). I am more talking about for errors and such

Example:

```js
function someThing(doWith) {
    return doWith.map(elem => {
        if (typeof elem !== "number") {
            super return "Not all are numbers" ;
        return elem * 2;
    });
}
```


Sent: August 28, 2017 3:43 PM
Subject: Re: super return

Well, there's already .map(), .find() and .filter() for returning values from arrays


--
Michael J. Ryan - [email protected] - http://tracker1.info

Please excuse grammar errors and typos, as this message was sent from my phone.

On Aug 28, 2017 12:30 PM, "Sebastian Malton" <[email protected]> wrote:
I have seen some people want to modify some of the array prototype functions, especially forEach, so that returning from them returns a value. 
However, I have also seems that this could break things since in some cases, again forEach, the return value in explicitly defined. 

Thus I propose the new syntax `super return` and any other positive number of supers. This syntax is currently not valid in any scenario and with the current meaning of super seems, to me at least, relativity easy to understand. 

The outcome of this basically means "return from current context up one level and then return from there".

A current method of doing this is by using try / catch but it is not ideal. Using the above method I believe that it would be able to be better optimized.


_______________________________________________
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