Re: Property names for public symbols

2015-02-12 Thread Jordan Harband
Based on my understanding of the spec, I'd say that String, Boolean, etc are not "classes" at all, since they don't have a [[HomeObject]] - they're just constructor functions. On Thu, Feb 12, 2015 at 7:55 PM, Gary Guo wrote: > Actually I disagree with you. `Class` will not be confusing, since as

Re: extends null

2015-02-15 Thread Jordan Harband
Rather than making "extends null" alone a runtime error at class evaluation time, is there a reason not to instead, make only a reference to "super" in the constructor of a class that extends null be a runtime error at class evaluation time? On Sun, Feb 15, 2015 at 11:12 AM, Mark S. Miller wrote:

Re: Add String.prototype[@@toStringTag] and other pre-ES6 constructors' toStringTag property

2015-02-17 Thread Jordan Harband
Hi Gary - the problem with this suggestion, is that in ES6 those prototypes are *not* exotic objects. So, setting @@toStringTag on `Boolean.prototype`, for example, would send `Boolean.prototype` itself down a legacy code path that might depend on an internal slot on a Boolean object, say, `Boolean

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Jordan Harband
Personally I'd love to see `Array.empty`, `Function.empty`, `Map.empty`, `String.empty`, etc as nonconfigurable nonwritable frozen/sealed/extensionsPrevented available by default - that might provide the (polyfillable) use case Kyle is currently describing, and might provide a path to making builti

Re: Array.prototype change (Was: @@toStringTag spoofing for null and undefined)

2015-02-19 Thread Jordan Harband
Does it not make sense anyways for Object.freeze on a RegExp instance to prohibit https://people.mozilla.org/~jorendorff/es6-draft.html#sec-regexpinitialize from being called? `var regex = Object.freeze(/a/g); regex.compile('b', 'i');` should throw imo. On Thu, Feb 19, 2015 at 1:13 PM, Mark S. Mi

Re: *.empty Idea

2015-02-22 Thread Jordan Harband
I'd love to bring a proposal to the committee for this since it seems like there's interest. I suspect that even though some of the "empties" seem useless to some, somebody somewhere will find a use case, and consistency is useful (that everything that could have a concept of "empty" would have a

Re: short-circuiting Array.prototype.reduce

2015-02-24 Thread Jordan Harband
Since nobody's mentioned it yet, I wanted to add that Array#{some, every, find, findIndex} are the only existing Array methods (I'm sure I missed something though) that take iteration functions with early-exit behavior, and none of them can be implemented with `Array#reduce` in an efficient fashion

Re: How to tell function and generator function apart?

2015-03-03 Thread Jordan Harband
It's not quite that simple due to variations across different engines, but I've got a module https://www.npmjs.com/package/is-generator-function that covers it. On Tue, Mar 3, 2015 at 9:07 AM, Damian Senn wrote: > Hi Gui > > On 03/03/2015 05:41 PM, Guilherme Souza wrote: > >> Hi all, >> >> I was

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

2015-03-10 Thread Jordan Harband
Would `new Set(arr.concat(substrings)).length === arr.length` work? Personally I find the "some" approach the clearest, though. On Tue, Mar 10, 2015 at 1:42 PM, Garrett Smith wrote: > On 3/10/15, Andrea Giammarchi wrote: > > I'm still having hard time understanding what's the difference between

Re: Comma operator in Arrow functions

2015-03-14 Thread Jordan Harband
To me, `a=()=>1,2;` looks like `statement1,statement2` where `statement1` is the arrow function, and `statement2` is `2`. On Sat, Mar 14, 2015 at 12:37 PM, Caitlin Potter wrote: > ConciseBody is an AssignmentExpression in this case, so I believe the > comma is a syntax error. > > > > > On Mar 14

Re: Mechanism to provide number grouping in numeric literals

2015-03-14 Thread Jordan Harband
Typically for setTimeout I use exponential notation to denote seconds, or when there's lots of zeroes - ie, `1e3` means "1000 ms" or "1 s". eg for 300,000, I'd do 300e3, or for 30,000,000 I'd do 30e6. On Sat, Mar 14, 2015 at 8:51 PM, Biju wrote: > When I want to write code to put timeout for 3 s

Re: Supporting feature tests directly

2015-03-21 Thread Jordan Harband
In http://npmjs.com/make-generator-function, https://www.npmjs.com/package/make-arrow-function, and the tests for https://github.com/es-shims/RegExp.prototype.flags/blob/master/test/index.js#L6-L12, I use `Function` eval to test for support of these things - one could do the same with `let`, `const

Re: Supporting feature tests directly

2015-03-22 Thread Jordan Harband
The only concern I'd have with a symbol approach is that there are likely to be engine variances in the future - in the case of "let", knowing that the syntax is supported doesn't mean that ES6's semantics apply, it just means it won't throw a SyntaxError. If that's the sole goal - detecting Synta

Re: Supporting feature tests directly

2015-03-25 Thread Jordan Harband
I don't believe test262 can yet be run in a browser (only directly against a browser engine), nor run in ES3 browsers (so that shimmed engines can be tested) so that doesn't yet solve my use cases, although I can't speak for Kyle. On Wed, Mar 25, 2015 at 9:32 PM, James Kyle wrote: > This exists:

Re: this value inside anonymous generator

2015-03-30 Thread Jordan Harband
Can you not just use .bind here? ``` spawn(function* () { let data = yield this.fetchData(); }.bind(this)); ``` On Mon, Mar 30, 2015 at 11:38 PM, Niloy Mondal wrote: > I wrote some code like the following in tracuer > > ``` > class Foo { > constructor() { > spawn(function*() { > l

Re: Unicode normalization problem

2015-04-01 Thread Jordan Harband
Unfortunately we don't have a String#codepoints or something that would return the number of code points as opposed to the number of characters (that "length" returns) - something like that imo would greatly simplify explaining the differences to people. For the time being, I've been explaining th

Re: Existential Operator / Null Propagation Operator

2015-04-06 Thread Jordan Harband
Wouldn't option 1 provide the transitivity you're discussing? If `a?.b.c` calls `(void 0).c` then `(a?.b).c` and `a?.b.c` would be identical, and both throw a TypeError. >From my reading, it seems like option 2 is the one that does not provide transitivity, and tbh would surprise me greatly in the

Re: Array.prototype.find - Proposal for (breaking) change of API

2015-04-07 Thread Jordan Harband
Then how could you find `undefined` in an array? That's a real use case too. In your A example, I'd represent that as: ``` var paths = files.map(file => path.resolve(base, file)); var found = paths.find(filePath => fs.existsSync(filePath)); ``` … and then `found` would be the resolved path you're

Re: Well-Known Symbols: Array item getter/setter

2015-04-09 Thread Jordan Harband
One advantage of this approach is that more "spec magic" can be implemented in terms of the language - it would also make subclassed arrays more versatile instead of having to always be a Proxy. On Thu, Apr 9, 2015 at 11:35 AM, Axel Rauschmayer wrote: > Proxies should be enough for this. Is ther

Re: Number.prototype not being an instance breaks the web, too

2015-04-13 Thread Jordan Harband
Please note that the `@@toStringTag` changes mean that we do need to always have a Number.prototype method that throws when the value does not have a [[NumberData]] internal slot - I'm using `Number#toString` for that right now, but others may now be relying on the throw behavior of `Number#valueOf

Re: Object.entries in 2015

2015-04-14 Thread Jordan Harband
The other motivation might be subclasses - MyArray.from creates a MyArray, MyMap.from would create a MyMap. On Tue, Apr 14, 2015 at 2:03 AM, Leon Arnott wrote: > > The Map constructor takes an iterable of [key, value] pairs. Array.from > > takes an iterable of elements.This asymmetry is presumab

Re: Nailing object property order

2015-04-15 Thread Jordan Harband
For what it's worth, forcing an enumeration order does make polyfilling harder, assuming there's an engine out there that *doesn't* already use that ordering. On Wed, Apr 15, 2015 at 6:39 PM, wrote: > Hello! > Why does ES6 specify the order of keys in objects, maps and sets? > Specifically secti

Re: Putting `global` reference in specs

2015-04-17 Thread Jordan Harband
I was under the impression there'd been some interest in a `Reflect.global()` as a uniform method of providing the global object, or a proxy to one, in all engines. That would be something that's easily polyfilled back as far as we like, would allow most code that currently relies on indirect eval

Re: Merge map values

2015-04-28 Thread Jordan Harband
Would `new Map(maps.reduce((e, m) => e.concat(Array.from(m)), []))` not create a new Map from merging an array of `maps`? (It relies on the `Map.prototype.[Symbol.iterator]` which is `Map#entries`, and the `iterable` argument of the `Map` constructor) On Tue, Apr 28, 2015 at 6:06 AM, Andrea Giamma

Re: *.empty Idea

2015-04-30 Thread Jordan Harband
Isiah Meadows >> wrote: >>> >>> On Feb 23, 2015 6:06 AM, "Andrea Giammarchi" < >>> andrea.giammar...@gmail.com> wrote: >>> >>> > On Sun, Feb 22, 2015 at 11:18 PM, Jordan Harband >>> wrote: >>> >> [...] >

Re: *.empty Idea

2015-04-30 Thread Jordan Harband
I don't see how it would be possible in ES6 user code to ever make a Map/Set or a Map/Set subclass instance immutable, since `Map.prototype.set.call`/`Set.prototype.add.call` will operate on any Map/Set-like object's `[[MapData]]`/`[[SetData]]` internal slot. The only thing I can think of would be

Re: Can't do push in forEach

2015-05-14 Thread Jordan Harband
`arr.push` is `Array.prototype.push`. If you want it bound to `arr`, you'd need to use `.bind` or actually call it with `arr.push()`. `arr.push.only` would lose the context of the "arr", so that's not an option for your use case as described. Arrow functions (with Array#map perhaps?) are your best

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 Jordan Harband
What if I have an "int64" function already defined? Will this skip over my int64 function? What about `a = something(0)` - will that call my "something" function, whereas "int64" is special and skipped over? On Mon, May 18, 2015 at 11:16 AM, Benjamin Gruenaum wrote: > What about non-default para

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

2015-05-31 Thread Jordan Harband
Would `Reflect.ownKeys` or `Reflect.enumerate` help you here? On Sun, May 31, 2015 at 4:42 AM, Gray Zhang wrote: > Since class’s members are non-enumerable by default (which is a good > choice) we cannot use for .. in to iterate over all members of an > instance, the same problem could exists in

Re: Reflect.type

2015-06-06 Thread Jordan Harband
How would your `isA` work across realms, taking a built-in constructor? `[1,2] instanceof Array` does not, which is why `Array.isArray` exists. `Object(42) instanceof Number` would have the same problem. if `class SubThing extends Thing {}`, then `new SubThing instanceof Thing` would be true. Bas

Re: Example of real world usage of function bind syntax

2015-06-11 Thread Jordan Harband
I find the call form of the operator (`a::b()`) very useful on its own. However, I think the main question is, will shipping the prefixed bind or prefixed call forms of the operator (`::a.b`, `::a.b()`), and/or the bind form of the operator (`a::b`), definitely preclude future extension with parti

Re: RegExp.escape

2015-06-12 Thread Jordan Harband
The primary advantage to making it be a function (also doing it as syntax would be great too!) is that it's polyfillable, which means that all browsers could instantly take advantage of known-safe regex escaping. On Fri, Jun 12, 2015 at 11:34 AM, Alexander Jones wrote: > At risk of bikeshed, I t

Re: RegExp.escape()

2015-06-13 Thread Jordan Harband
Would it help subclassing to have the list of syntax characters/code points be on a well-known-symbol property? Like `RegExp.prototype[@@syntaxCharacters] = Object.freeze('^$\\.*+?()[]{}|'.split(''));` or something? Then @exec could reference that, and similarly `RegExp.escape` and RegExpSubclass.e

Re: Re: Template site objects and WeakMap

2015-06-17 Thread Jordan Harband
Could I not use `Object(Symbol.for('some global registry symbol'))` as a `WeakMap` key? That would return a realm-specific object, of course. On Wed, Jun 17, 2015 at 10:19 AM, Benjamin Gruenbaum wrote: > > congratulations and THANK YOU! I learned something important reading > your messages. The

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

2015-06-20 Thread Jordan Harband
http://es-discourse.com already exists as an alternative place to discuss things if one doesn't wish to email this list. It may be worth exploring using that more fully before asking TC39 to consider an alternative to their existing mailing list. On Sat, Jun 20, 2015 at 7:14 AM, Eric B wrote: >

Re: insteadof operator

2015-06-25 Thread Jordan Harband
What would happen if this operator was used in the global scope? On Thu, Jun 25, 2015 at 3:41 PM, Bucaran wrote: > Sometimes you have a function that receives a parameter shadowing an > existing function or variable in the parent scope. > > In _some_ cases I would like to use the same variable n

Re: Awaiting thenables

2015-06-26 Thread Jordan Harband
so, in other words, `await thenable` would wrap the thenable in `Promise.resolve`, which would ensure it fires on the next tick? On Fri, Jun 26, 2015 at 12:36 PM, Mark S. Miller wrote: > It would be postponed to a later job, i.e., turn of the event loop. > > -- > Cheers, > MarkM > > On Jun 2

Re: String.prototype.trimRight/trimLeft

2015-07-20 Thread Jordan Harband
On the contrary -"left" always begins at index 0 - "start" is sometimes index 0, sometimes index (length - 1). I think "left" and "right" are the right names; "start" and "end" would require unicode bidirectional stuff. On Mon, Jul 20, 2015 at 11:25 PM, Norbert Lindenberg < ecmascr...@lindenbergso

Re: name anonymous functions on property assignments

2015-07-26 Thread Jordan Harband
What is the function's name if the computed object literal key is a Symbol? ie, what does the following output: ```js const sym = Symbol('something'); const o = { [sym] () {} }; console.log(o[sym].name); ``` Currently it appears Babel outputs an empty string for this case. If the current spe

Re: please add orEqual operator

2015-08-10 Thread Jordan Harband
fwiw, just like String#includes, "contains" has been renamed to Array#includes (see https://github.com/tc39/Array.prototype.includes/) On Sun, Aug 9, 2015 at 8:41 PM, Isiah Meadows wrote: > Or, there is the likely ES7 Array#contains for comparing multiple numbers. > > ```js > [1, 2, 3].contains(

Re: Question about [[Enumerate]] and property decision timing

2015-08-10 Thread Jordan Harband
I interpreted this spec text (and the included generator code example) to mean that the first "next" is the thing that determines the keys to be enumerated - since the generator function body (including the Reflect.ownKeys call) is not executed until that point. The question was also raised on tha

Re: please add x .= f()

2015-08-10 Thread Jordan Harband
For that, you'd do `if (s.charAt(0) === '/') { s = s.slice(1); }` - which is only slightly more verbose than your example, without the burden of new syntax. On Mon, Aug 10, 2015 at 1:57 PM, Soni L. wrote: > Welp I keep replying this wrong (how should I configure my email client?) > -

Re: UInt8ClampedArray Bitwise operators?

2015-08-12 Thread Jordan Harband
Also `instanceof` overloading via `Symbol.hasInstance` On Wed, Aug 12, 2015 at 10:44 AM, Daniel Ehrenberg wrote: > On Wed, Aug 12, 2015 at 4:50 AM, Caitlin Potter > wrote: > > Operator overloading or value types might make it look a lot prettier > some day (though iirc element assessor overload

Re: Exponentiation operator precedence

2015-08-26 Thread Jordan Harband
Is there also perhaps a potential performance/static analysis benefit in having it be syntax, rather than a builtin function? `Math.pow` can be overwritten, and varies per-realm, but `**` can not and does not. On Wed, Aug 26, 2015 at 8:21 PM, Mark S. Miller wrote: > > > On Wed, Aug 26, 2015 at 6

Re: Object.clone - not quite a proposal

2015-09-24 Thread Jordan Harband
Cloning is not a trivial matter. You may be interested in these previous discussions before discussing further: - https://esdiscuss.org/topic/the-structured-clone-wars - https://esdiscuss.org/topic/structured-clones - https://esdiscuss.org/topic/structured-cloning-transfering-of-promises-and-st

Re: Weak References

2015-09-27 Thread Jordan Harband
`WeakMap` holds the *key* weakly, not the value - it holds the value strongly. If you have the key such that you can use it to get at the value, you'll always have the value. `WeakRef` is a container around a weakly held *value*, which I don't believe is possible to fully polyfill, even with `Weak

Re: Function.prototype.partial

2015-10-04 Thread Jordan Harband
(note, it couldn't be a direct proxy to `bind` because `bind(null)` permanently sets the "this" value (ie, `(function () { return this }).bind(null).call([])` will return null or the global object, not the empty array. the polyfill would be a bit trickier, and couldn't use "bind" under the hood wit

Re: Swift style syntax

2015-10-12 Thread Jordan Harband
For that, the question would arise: is `scores.reduce((a, b) => a + b)` and `bools.filter(x => !x)` so troublesome to write that it's worth the added complexity to the language? "it would be nice" generally doesn't outweigh increased implementation and maintenance cost to implementors, learners, to

Re: for-of with `const` variable

2015-10-17 Thread Jordan Harband
It's a v8 bug in sloppy mode, in that v8 sloppy mode is still using legacy let/const semantics. `'use strict'; for (const i of [1, 2, 3]) console.log(i)` will print out what you expect, since it properly rebinds per iteration. On Sat, Oct 17, 2015 at 11:09 PM, Isiah Meadows wrote: > I was toyin

Re: Why is no line break is needed in ArrowFunction?

2015-10-21 Thread Jordan Harband
Although, sadly,: `` function * foo () { } ``` is completely valid - although I also agree with Brian, and think both "yield*" and "function*" are one unit, and should be visually grouped as such. On Wed, Oct 21, 2015 at 1:39 PM, Brian Terlson wrote: > Sure, this works for syntax questio

Re: Decorators for functions

2015-10-21 Thread Jordan Harband
One thing that seems to be missing from this thread is acknowledgement that decorators are not just simple function wrappers. They take a property descriptor as an argument, and they can return a new property descriptor - which allows an object or "class" to have its shape determined at creation ti

Re: Decorators for functions

2015-10-22 Thread Jordan Harband
Andreas, thanks for correcting me on the optimization angle. I've been under that impression for awhile. Are you saying that to achieve the optimization I envision, we'd need declarative syntax for descriptor properties (like enumerability etc), rather than function calls? or would that also preve

Re: Re: Subclassing Function

2015-10-24 Thread Jordan Harband
Perhaps you would be interested in the current proposal for Call Constructors https://github.com/tc39/ecma262/blob/master/workingdocs/callconstructor.md ? On Sat, Oct 24, 2015 at 3:39 PM, Nelo Mitranim wrote: > Separate methods can be decorated. Which raises the question whether the > proposal i

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

2015-10-25 Thread Jordan Harband
This immediately raises some questions for me: - what would `foo()#` return? (a bare function call - the question applies to strict mode, and sloppy mode) - what would `foo.bar.call(baz)#` return? (foo? or baz?) - what would `baz.quux = foo.bind(bar); baz.quux()#` return? (baz? or bar?) - what

Re: Calling toString on function proxy throws TypeError exception

2015-10-27 Thread Jordan Harband
Mark: considering that explicitly invoking a builtin prototype method, expecting a throw, to test for the [[Call]] internal slot, was the branding approach the committee agreed to preserve when it reaffirmed Symbol.toStringTag, as an alternative to `Object#toString.call`, I think Claude's point ("T

Re: Map literal

2015-10-27 Thread Jordan Harband
fwiw, my Object.entries proposal ( https://github.com/ljharb/proposal-object-values-entries ) would allow you to do: `new Map(Object.entries({ a: 'b', b: 'c' }))`. On Tue, Oct 27, 2015 at 4:36 PM, Alexander Jones wrote: > I agree this is pretty important. Using actual maps really frees up a lot

Re: Concise Method Binding

2015-11-09 Thread Jordan Harband
In your first example, the arrow function's "this" would be the "this" of the context the "class" is defined in - it wouldn't be bound at all. Can you point me to an example of where that example "bar" is a function bound to the instance? On Mon, Nov 9, 2015 at 5:45 PM, JD Isaacks wrote: > Consi

Re: String.prototype.padLeft / String.prototype.padRight

2015-11-16 Thread Jordan Harband
t > > [1] https://mail.mozilla.org/pipermail/es-discuss/2015-October/044354.html > [2] https://github.com/tc39/proposal-string-pad-left-right > [3] http://www.unicode.org/reports/tr29/ > [4] > https://mail.mozilla.org/pipermail/es-discuss/2015-July/thread.html#43667 > &g

Re: String.prototype.padLeft / String.prototype.padRight

2015-11-17 Thread Jordan Harband
In the TC39 meeting today, we discussed these concerns and decided to rename the proposal from padLeft/padRight to padStart/padEnd ( https://github.com/tc39/proposal-string-pad-start-end/commit/35f1ef676f692bfc1099f9ed7c123bd2146f9294) - and correspondingly, to investigate providing trimStart/trimE

Re: Reflection to know if executed within a generator/async ?

2015-12-03 Thread Jordan Harband
I think that migration path is typically 1) make the breaking change so that everything returns a promise ASAP, 2) seamlessly migrate sync parts to async at your leisure, without a breaking change. On Thu, Dec 3, 2015 at 1:07 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > Sorry I m

Re: Indirect references to variables

2015-12-08 Thread Jordan Harband
Can you not put each class in its own module, and simply require, by name, the one you want? On Tue, Dec 8, 2015 at 10:19 PM, John Gardner wrote: > Only at top-level. This issue actually surfaced when I realised I had no > way to indirectly access classes by name... and for some reason, neither

Re: Propose simpler string constant

2015-12-15 Thread Jordan Harband
That seems hazardous - if someone is converting a "var" codebase to "const" and "let", and they convert `var foo;` to `const foo;` expecting it to be undefined, the current TDZ error will be much more helpful to them than a silent change of meaning in their code to `const foo = 'foo';`. On Tue, De

Re: Propose simpler string constant

2015-12-15 Thread Jordan Harband
y sure what Brendan says **is** indeed what developers > want so I'd +1 that without problems. > > Regards > > On Tue, Dec 15, 2015 at 4:44 PM, Jordan Harband wrote: > >> That seems hazardous - if someone is converting a "var" codebase to >> "const

Re: HTML-like comment behavior inconsistent

2016-01-02 Thread Jordan Harband
Annex B documents and standardizes legacy browser behavior - the way it's specified is the way browsers already do it, so the "consistent" behavior you're talking about would conflict with the way existing code already works. On Sat, Jan 2, 2016 at 12:56 PM, kdex wrote: > ES2015's annex section

Re: Automatically giving symbols descriptions

2016-01-06 Thread Jordan Harband
One difference is that functions are syntax - I don't believe `var foo = new Function();` will have a "name" property inferred. Because `Symbol` is an identifier that has to be looked up on the global object, might there be difficulty inferring what the name should be? Hopefully someone with more

Re: Syntax Sugar for protected state

2016-01-19 Thread Jordan Harband
It would be helpful to link to gists or github repos rather than pasting code inline. You may also be interested to read this proposal: https://github.com/wycats/javascript-private-state On Tue, Jan 19, 2016 at 8:43 AM, 森建 wrote: > @Andrea Giammarchi > > Thank you for supporting my code, I got

Re: Object.getOwnPropertyDescriptors still at stage 0

2016-01-20 Thread Jordan Harband
but if he's > ultra busy (he usually is) and somebody else would like to champion this > I'd be happy to update the README with a champion reference. > > AFAIK Jordan Harband is the one taking care already of the poly in the npm > repo so if you (Jordan) will to champion this I&

Re: Import Shorthand Strawman

2016-01-26 Thread Jordan Harband
That is currently valid syntax for a module that has no exports - ie, a module for which you're relying solely on side effects. One popular usage is `import 'es6-shim';` for example. On Tue, Jan 26, 2016 at 12:31 PM, Paul Tyng wrote: > I went through the archives and existing proposals, I didn't

Re: Import Shorthand Strawman

2016-01-26 Thread Jordan Harband
also, would identifier would `import '3d-is-cool';` create? On Tue, Jan 26, 2016 at 12:43 PM, Jordan Harband wrote: > That is currently valid syntax for a module that has no exports - ie, a > module for which you're relying solely on side effects. One popular usage > is

Re: Additional methods for Objects (like Arrays)

2016-02-05 Thread Jordan Harband
Object.entries and Object.values must remain consistent with Object.keys and will return arrays - luckily those are iterable too. On Friday, February 5, 2016, Isiah Meadows wrote: > I think that these methods should exist in iterator prototypes, with the > native iterators subclassing something

Re: monadic extension to do-notation

2016-02-07 Thread Jordan Harband
How is Promise an instance of Monad, if you can't ever have a Promise of a Promise? On Sun, Feb 7, 2016 at 9:59 AM, Raphael Mu wrote: > The `a < -b` issue could be solved by using a different operator, like > ` > On Sun, Feb 7, 2016 at 12:35 PM Kevin Smith wrote: > >> Why not just use await wit

Re: Why are ES6 class methods not automatically bound to the instance?

2016-02-10 Thread Jordan Harband
One of the wonderful features of many prototype methods is that they can be borrowed and .call-ed on other objects (imagine if you couldn't `Array.prototype.slice.call(arguments)`!). Auto binding would cripple this feature, and it seems like opting out would be harder than opting in. I'm not sure

Re: Object.prototype.forIn

2016-03-04 Thread Jordan Harband
While I would like a function for this too, this is pretty trivial: ``` function* enumerate(obj) { for (var key in obj) { yield [key, obj[key]]; } } for (const [key, value] of enumerate(obj) { doStuff(key, value); } ``` On Fri, Mar 4, 2016 at 1:08 PM, Edwin Reynoso wrote: > Okay that makes s

Re: meeting notes for march 2016?

2016-04-05 Thread Jordan Harband
The notes were taken, but have not yet been approved and posted on https://github.com/rwaldron/tc39-notes . On Tue, Apr 5, 2016 at 11:22 AM, Raul-Sebastian Mihăilă < raul.miha...@gmail.com> wrote: > Has anybody managed to take meeting notes during the last meeting? If so, > can they please share

Re: Do await statements unblock synchronously?

2016-04-11 Thread Jordan Harband
As I understand it, `await` always fires in the next tick, if it's observable. The opportunity to optimize that to "same tick" exists if an engine can prove it's not observable. On Mon, Apr 11, 2016 at 9:54 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > > I suppose I'm asking for

Re: Function#toString revision: JSDoc comments?

2016-04-16 Thread Jordan Harband
As I see it, the primary purpose of the `Function#toString` proposal is to document what browsers already do, and tighten it down so they can't deviate further (which some browsers already have begun to do with "class", for example). "Preceding comments" would be a very hard thing to specify witho

Re: New Assignment Operators (Not bit-wise OR)

2016-04-17 Thread Jordan Harband
This has been discussed many times before: - https://esdiscuss.org/topic/operators-and - https://esdiscuss.org/topic/logical-assignment-operators - https://esdiscuss.org/topic/is-much-needed - https://esdiscuss.org/topic/please-add-orequal-operator If you read through these threads, you may fi

Re: JavaScript Language feature Idea

2016-04-19 Thread Jordan Harband
Let's not cry doomsday because there's not an easy path to adding "-1" array access, when indexing into a list of things *in the first place* is already a potential code smell. `endsWith` was able to be added because *it didn't break anything*. `contains` was renamed to `includes` because the form

Re: operator overloading proposal

2016-05-10 Thread Jordan Harband
Why would you ever want to violate the algebraic properties of operators, such that `a += b` wasn't exactly equivalent to `a = a + b`, `a *= b` not equivalent to `a = a * b`, etc? I'm quite confident that any proposal that allowed for that would get tons of pushback. On Tue, May 10, 2016 at 11:26

Re: Re: Tracking proposals should be standardized with issues

2016-05-11 Thread Jordan Harband
New proposals should be a repo. Any discussion or changes in the proposal should be centered in that repo. Those repos will be transferred to the TC39 org once they hit stage 1. That repo should include links to any relevant es-discuss threads. Old proposals may be mired in legacy wikis and es-dis

Re: Tracking proposals should be standardized with issues

2016-05-12 Thread Jordan Harband
Yes, any employee of TC39 member organizations is also a member, and can participate on behalf of their company. On Wed, May 11, 2016 at 7:23 PM, G. Kay Lee < balancetraveller+es-disc...@gmail.com> wrote: > Sorry but this is confusing. So any employee of TC39 member organizations > can be a champ

Re: Should RegExp(regexp, flags) always return a functional RegExp for reasonable values of flags?

2016-05-19 Thread Jordan Harband
I'm not as sure about `eval`, but absolutely `new RegExp(rx.source, rx.flags)` should always imo reproduce a functionally equivalent regex. On Thu, May 19, 2016 at 8:21 AM, Claude Pache wrote: > Hi, > > Given a RegExp object `rx` and a string `f` that contains legal RegExp > flag characters, sho

Re: Should RegExp(regexp, flags) always return a functional RegExp for reasonable values of flags?

2016-05-19 Thread Jordan Harband
Ah - in that case, no, I would not necessarily expect that the source of a u-mode regex would produce a valid regex in another context without the "u" flag. On Thu, May 19, 2016 at 10:18 AM, Claude Pache wrote: > > > Le 19 mai 2016 à 17:54, Jordan Harband a écrit : >

Re: Proposal: importing selected chucks of a module into an object

2016-05-24 Thread Jordan Harband
This is usually part of the reason why small modules are recommended, rather than large object bags of things (including many named exports). Have you considered putting each thing you want to import as the default export of a separate file? On Tue, May 24, 2016 at 9:20 PM, Norbert de Langen < nor

Re: String.prototype.padLeft / String.prototype.padRight

2016-05-25 Thread Jordan Harband
/ > > Thanks, > Norbert > > > > On Nov 17, 2015, at 13:07 , Jordan Harband wrote: > > > > In the TC39 meeting today, we discussed these concerns and decided to > rename the proposal from padLeft/padRight to padStart/padEnd ( > https://github.com/t

Re: String.prototype.trimRight/trimLeft

2016-05-25 Thread Jordan Harband
gt;> >>> OK, it was added to the agenda for the next meeting (will be >> presented by >> >>> Sebastian Markbage), so can be discussed in detail. I agree that >> "start", >> >>> and "end" are now probably better fit (because of

Re: String.prototype.trimRight/trimLeft

2016-05-25 Thread Jordan Harband
* sorry, to clarify: This was discussing padding. trimLeft/trimRight / trimStart/trimEnd is still stage 2 On Wed, May 25, 2016 at 2:56 PM, Jordan Harband wrote: > Closing the loop on this: this feature is now stage 4, and will be > included in ES 2017. https://github.com/tc39/ecma262/pu

Re: Object.getOwnPropertyDescriptors still at stage 0

2016-05-25 Thread Jordan Harband
Closing the loop on this: this proposal is now stage 4, and will be included in ES 2017. https://github.com/tc39/ecma262/pull/582 Polyfill: https://www.npmjs.com/package/object.getownpropertydescriptors On Wed, Jan 20, 2016 at 9:26 PM, Jordan Harband wrote: > If Rick is unavailable, and af

Re: Suggestion: "Object.hasOwnProperty"

2016-05-27 Thread Jordan Harband
Reflect is only for API mirrors to Proxy traps - that's why Reflect.enumerate was removed along with the Enumerate Proxy trap. On Friday, May 27, 2016, Isiah Meadows wrote: > I'd, for ergonomic reasons, would prefer it on Reflect. I very frequently > alias this function, so having it as a static

Re: Subclassing native class and instanceof operator

2016-05-30 Thread Jordan Harband
In which engine did you try this? Please refer to http://kangax.github.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 wrote: > Recently I encountered an issue about subclassing Error and instance > o

Re: String.prototype.padLeft / String.prototype.padRight

2016-05-31 Thread Jordan Harband
t a future edition can do something more > useful when the use cases for these methods become clearer? > > Thanks, > Norbert > > > > On May 25, 2016, at 5:56 , Jordan Harband wrote: > > > > Closing the loop on this: this proposal is now stage 4 and will be >

Re: Array.prototype.includesAll

2016-06-14 Thread Jordan Harband
It'd be nicer if it took an array, rather than being variadic. That also preserves the ability to add extra arguments in the future. On Tue, Jun 14, 2016 at 9:21 AM, Shahar Or wrote: > Hey, following up from: > > https://esdiscuss.org/topic/array-prototype-includes-with-multiple-arguments > > Ho

Re: Suggestion: Object.symbols

2016-06-16 Thread Jordan Harband
Symbols are enumerable by default just like normal properties. Object.assign skips non-enumerable Symbols. Object.defineProperty can be used to create a non-enumerable Symbol, but I believe that only impacts Object.assign (and specific enumerability methods, obv). On Thursday, June 16, 2016, dooda

Re: Symbol for modifying property lookup?

2016-07-13 Thread Jordan Harband
https://facebook.github.io/react/blog/2016/07/13/mixins-considered-harmful.html may also be a helpful read. (fwiw, any Symbol to modif

Re: Feature-Request: Add Range type data

2016-07-14 Thread Jordan Harband
`new Array(myRange)` could never work, but `[...myRange]` could. On Thu, Jul 14, 2016 at 9:33 PM, Dayvson Lima wrote: > Example: > > var myRange = new Range(0,4); > > myRange == (0..4) #=> true > > > new Array(myRange) #=> [0, 1, 2, 3, 4] > > var charRange = new Range('a', ' d'); #=> ('a'..'

Re: Reason for strange ExponentiationExpression & UpdateExpression productions?

2016-07-20 Thread Jordan Harband
`-x ** y` is absolutely a SyntaxError because of the disagreement between many programming languages which treat that as `(-x) ** y` and math itself which treats it as `-(x ** y)`. To resolve the debate about "what will users expect", this early syntax error ensures that programmers get the joy of

Re: Reason for strange ExponentiationExpression & UpdateExpression productions?

2016-07-20 Thread Jordan Harband
d anywhere? > If so, maybe I could find the answer to questions like these myself in > future. > > Thanks, > Bradford > > On Wed, Jul 20, 2016 at 12:55 PM Jordan Harband wrote: > >> `-x ** y` is absolutely a SyntaxError because of the disagreement between >> man

Re: Code smell? Iterator prototype has iterator method that returns "this"

2016-07-26 Thread Jordan Harband
`new weirdFunction()` would `=== iter` because a constructor that returns an object (`this`), returns that object when `new`ed - which is how functions have worked since ES3 (or probably ES1). On Tue, Jul 26, 2016 at 9:31 PM, Michael Theriot < michael.lee.ther...@gmail.com> wrote: > There are man

Re: The `super` keyword doesn't work as it should?

2016-07-27 Thread Jordan Harband
Could you not make `multiple` be a function that returns a Proxy, rather than achieving multiple inheritance by copying properties? On Wed, Jul 27, 2016 at 8:19 PM, /#!/JoePea wrote: > For reference, here's the implementation of `multiple()` where multiple > constructors calls are possible, usin

Re: improve import syntax

2016-07-31 Thread Jordan Harband
You may be interested in https://www.npmjs.com/package/import-js. On Sun, Jul 31, 2016 at 12:05 PM, Frankie Bagnardi wrote: > Oh I see your point. Still extremely unlikely the syntax will change. > > On Sun, Jul 31, 2016 at 11:56 AM, Kris Siegel > wrote: > >> The syntax could stay the same whil

  1   2   3   4   5   >