Re: Ability to specify an iterator in for...of

2016-03-11 Thread Edwin Reynoso
No need, just replace `this` with the passed parameter: ```javascript function* keyValIterator (address) { for (let prop in address) { yield [ prop, address[prop] ]; } } var address = { street: '420 Paper St.', city: 'Wilmington', state: 'Delaware' }; for (let [ key, val ] of

Re: Object.prototype.forIn

2016-03-04 Thread Edwin Reynoso
y)`, > so properties in the prototype chain are not an issue here. > > On Fri, Mar 4, 2016 at 1:04 PM, Edwin Reynoso <eor...@gmail.com> wrote: > >> Sorry guys but this is very wrong, for in, loops through all properties >> even the ones inherited from all prototypes, while O

Re: Object.prototype.forIn

2016-03-04 Thread Edwin Reynoso
Sorry guys but this is very wrong, for in, loops through all properties even the ones inherited from all prototypes, while Object.keys() and Object.entries() do not. They are indeed very different On Fri, Mar 4, 2016 at 1:45 PM Langdon wrote: > Ahhh, nothing. I never think

Re: Syntax to get same object that method was called on (Easy method chaining)

2015-10-27 Thread Edwin Reynoso
get misleading >> results with the cascading operator in JS, even in this >> dramatically simplified form. >> >> I don’t really expect that this proposal (with these gotchas) would be >> able to reach consensus and make it into a ratified specification. >> >> >

Re: Syntax to get same object that method was called on (Easy method chaining)

2015-10-26 Thread Edwin Reynoso
@CaitIin see what your saying which would simplify things: `foo()#` returns `undefined` `foo.bar.call(baz)#` returns `foo` (correct?) `baz.quux = foo.bind(bar)` returns `baz` (correct?) and as for property accessors I think they should throw, it should only be for function calls, because why

Re: Syntax to get same object that method was called on (Easy method chaining)

2015-10-26 Thread Edwin Reynoso
always return > `this` i guess, but I'm not sure if chaining a super method should lookup a > method in the prototype first, or instance first > > On Oct 26, 2015, at 6:11 PM, Edwin Reynoso <eor...@gmail.com> wrote: > > @CaitIin see what your saying which would simplify things

Syntax to get same object that method was called on (Easy method chaining)

2015-10-25 Thread Edwin Reynoso
Could we get a way to basically to get the object back from after a method was called, so that instead of this: ```JS let obj = { doSomething() { // some side effect return 5; }, doSomething2() { // some other side effect return {x: 5}; } } obj.doSomething(); obj.doSomething2();

Re: Syntax to get same object that method was called on (Easy method chaining)

2015-10-25 Thread Edwin Reynoso
o#` return? (a data property) (throw? the > object? undefined?) > > On Sun, Oct 25, 2015 at 9:25 PM, Edwin Reynoso <eor...@gmail.com> wrote: > >> Could we get a way to basically to get the object back from after a >> method was called, so that instead of this: >&g

Re: Template strings as a template language.

2015-09-15 Thread Edwin Reynoso
This seems to be the same thing I posted before as [String.substitute()]( https://esdiscuss.org/topic/string-substitute) I guess I didn't explain correctly, but ayy I'm glad you guys are discussing this. On Tue, Sep 15, 2015 at 10:39 AM, Claude Pache wrote: > > Le 15

Re: String.substitute

2015-08-12 Thread Edwin Reynoso
then I'd say what's the point of `ES6` having `Hi.includes(H)` when we could of just did: ```JS function includes(str, included) { return str.indexOf(included) -1; } ``` On Wed, Aug 12, 2015 at 11:08 AM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Wed, Aug 12, 2015 at 7:31 AM, Edwin

Re: String.substitute

2015-08-12 Thread Edwin Reynoso
at 4:42 PM, Nathaniel Higgins n...@nath.is wrote: Am I being naive or could this just be written in user space? Sent from my iPhone On 12 Aug 2015, at 15:31, Edwin Reynoso eor...@gmail.com wrote: Yes of course, still requires 1.Destructuring, and making a function for each type of string

Re: String.substitute

2015-08-12 Thread Edwin Reynoso
`; ``` Compare to: ```JS let yearSentence = String.substitute({ year: 2015}, `This year is ${year}`); let ageSentence = String.substitute({ age:100 }, `I'm ${age} yrs old`); ``` On Wed, Aug 12, 2015 at 10:19 AM, Claude Pache claude.pa...@gmail.com wrote: Le 12 août 2015 à 15:41, Edwin Reynoso

Re: String.substitute

2015-08-12 Thread Edwin Reynoso
at 8:19 AM, Edwin Reynoso eor...@gmail.com wrote: @logan that's an interesting thought, which is why I posted this for discussion, Thinking of that, I'm kind of doubting most will like the function to only be able to take the literal instead as a variable because that's just messing

String.substitute

2015-08-12 Thread Edwin Reynoso
Could we make the following possible, I can't seem to think of a way to do it, since template literals are evaluated with the current scope, also tried with `eval` but shouldn't even use that at all: ```JS String.substitute( { year: 2015 }, `This year is ${year}` ); // Returns This year is 2015

Re: for statement with index and value

2015-07-13 Thread Edwin Reynoso
it determine that unless again this is special to Arrays?? because `b/index` could be anything else, that's not obvious compare to destructuring. On Tue, Jul 14, 2015 at 12:13 AM, Edwin Reynoso eor...@gmail.com wrote: So I'm assuming this would be special to arrays?? because destructuring

Re: for statement with index and value

2015-07-13 Thread Edwin Reynoso
So I'm assuming this would be special to arrays?? because destructuring works fine for anything that's iterable: meaning how would it know what to take out for Sets?? ```JS for(let value, index of [1,2]) { // do something } ``` With destructuring we at least know what's being extracted (not

Re: insteadof operator

2015-06-25 Thread Edwin Reynoso
I'm highly doubting something like this will be made just because of wanting to use the same variable name. What's the real use, besides more code than using a different variable name. On Thu, Jun 25, 2015 at 6:46 PM, Jordan Harband ljh...@gmail.com wrote: What would happen if this operator was

Re: Aliased object destructuring assignments?

2015-06-21 Thread Edwin Reynoso
```JS var {f: foo} = {f: 5}; foo == 5 // true ``` On Sun, Jun 21, 2015 at 8:50 PM, Salehen Rahman salehen.rah...@gmail.com wrote: I know that `import` allows us to alias imports, like so: ```javascript import { f as foo } from 'f'; ``` But what about object destructuring assignments?

Re: Move es-discuss to discuss.webplatform.org?

2015-06-19 Thread Edwin Reynoso
The only thing I don't like is the fact it's mixed with what's on discourse.specifiction.org. I post more on discourse.specifiction.org than on ES-Discuss, meaning I'm more comfortable bothering the people with my ideas there than on ES-Discuss. Plainly because it's not always ES related.

Re: Move es-discuss to discuss.webplatform.org?

2015-06-19 Thread Edwin Reynoso
OMG Yes please!!! On Fri, Jun 19, 2015 at 5:04 PM, Axel Rauschmayer a...@rauschma.de wrote: http://discourse.specifiction.org/t/upcoming-migration/805 Would it make sense to move es-discuss to that upcoming site? I’m not particularly fond of mailing lists and much prefer forums, especially

Re: Pick operator

2015-06-19 Thread Edwin Reynoso
Wow Bob that's really neat. I really like it. Because it returns an object instead of assigning like destructuring. So it's very useful. So LGTM now as I kept reading I got a little confused, just give me a moment I will. But +1 for me. :) On Sat, Jun 20, 2015 at 12:30 AM, Bob Myers r...@gol.com

Re: Language design

2015-06-12 Thread Edwin Reynoso
Yes please edit it, you don't have to repost. BTW the only thing I can agree with is the `Object.is()` which to me seems like the only problem it solves is `Object.is(NaN, NaN)` now returns true On Fri, Jun 12, 2015 at 7:11 PM, Kevin Smith zenpars...@gmail.com wrote:

Re: ES6 Proxy Function Call Trap

2015-06-11 Thread Edwin Reynoso
Proxy([new Person('Edwin', 'Reynoso', 16), new Person('That', 'Guy', 1000)], { get(target, property) { if(target[property] !== undefined) return target[property]; var arr = []; for(var person of target) { if(person[property].constructor === Function) { return function(...args) { for(var person

Re: ES6 Proxy Function Call Trap

2015-06-09 Thread Edwin Reynoso
that `Reflect` is not defined I got: `TypeError: people.logFullName is not a function` So I don't think that worked. On Tue, Jun 9, 2015 at 3:39 AM, Claude Pache claude.pa...@gmail.com wrote: Le 9 juin 2015 à 07:58, Edwin Reynoso eor...@gmail.com a écrit : **Or does someone know how to do

ES6 Proxy Function Call Trap

2015-06-08 Thread Edwin Reynoso
Let's say we have the following code: ``` class Person { constructor(fName, lName) { this.firstName = fName; this.lastName = lName; } logFullName() { console.log(this.firstName, this.lastName); } } var people = new Proxy([new Person('Edwin', 'Reynoso'), new Person('That', 'Guy')], { get(target

Re: why not just import new language into browser?

2015-05-25 Thread Edwin Reynoso
Lol you don't see the advantages, yet most do (including me). Why wouldn't we improve the language itself. So just leave the language alone like that, and let's focus on using plugins for other languages to work?? really?? and then we'll have to put in work into updating and fixing bugs on those

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

2015-05-18 Thread Edwin Reynoso
Don't you just mean: ``` function addWithType(a=0, b=0) { return int64(a) + int64(b); } ``` On Mon, May 18, 2015 at 2:16 PM, Benjamin Gruenaum benjami...@gmail.com wrote: What about non-default parameters? ___ es-discuss mailing list

Re: Re: Not forcing super in derived class's constructor?

2015-05-10 Thread Edwin Reynoso
Give it time, people don't check this everyday, and if they do. Wait till they come up with an answer, also today's mother's day. Ik it's been 3 days but again people don't check this everyday. I for one don't know the answer to this. ___ es-discuss

Re: Object arithmetic--operator alternative to Object.assign

2015-03-24 Thread Edwin Reynoso
For different objects this is the only way I see possible with destructuring. IMO it's a bit ugly and weird to read deep destructuring: ``` let x = { a: 1 }; let y = { b: 2 }; let { x: { a }, y: { b } } = { x, y }; ``` But I'd prefer Bob Myers's way: ``` let x = { a: 1 }; let y = { b: 2 };

Re: Object arithmetic--operator alternative to Object.assign

2015-03-24 Thread Edwin Reynoso
...@gmail.com wrote: On Tue, Mar 24, 2015 at 7:09 PM Edwin Reynoso eor...@gmail.com wrote: For different objects this is the only way I see possible with destructuring. IMO it's a bit ugly and weird to read deep destructuring: ``` let x = { a: 1 }; let y = { b: 2 }; let { x: { a }, y: { b } } = { x

Re: Accepting an array as the first parameter to String.prototype.includes

2015-03-10 Thread Edwin Reynoso
Well the current ES6 `.includes()` was before named `.contains()`: [String.prototype.includes] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#String.prototype.contains ) But if Garrett Smith was trying to point out that `.contains()` would be

Accepting an array as the first parameter to String.prototype.includes

2015-03-10 Thread Edwin Reynoso
There are times where I would like to check whether a string has every occurrence of certain strings/numbers: ``` var str = John, Mary, Bob, Steve; str.includes([Mary, Bob]); // true var str2 = John, Mary, Steve; str2.includes([Mary, Bob]); // false ``` So the way the above would work would