Re: Dash-case keys

2019-01-30 Thread T.J. Crowder
tes in the object initializer. Particularly not with the well-established convention of using camelCase in that situation when interoperating with objects that have (or act like they have) dash-named properties (like the CSSStyleDeclaration object on HTML elements). -- T.J. Crow

Re: PSA: You can find existing proposals at https://github.com/tc39/proposals

2019-01-22 Thread T.J. Crowder
On Sun, Jan 20, 2019 at 11:05 PM Frederick Stark wrote: > > There's also https://prop-tc39.now.sh/... (Interested, he clicks link.) > ...which is much more readable. (Recoiling, he reminds himself that "more readable" is a **deeply** subjective concept. ;-)

Re: Re: Proposal: Class Templates

2019-01-17 Thread T.J. Crowder
y = ${this.y}, z = ${this.z}`); } }; }; const obj = new (Abc(4, 5, 6))(1, 2, 3); obj.show(); ``` https://jsfiddle.net/gh3dv297/ -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Re: Proposal: Class Templates

2019-01-16 Thread T.J. Crowder
js new Abc`4, 5, 6`(1, 2, 3) ``` (parsing the "arguments" in the template from the strings array passed to the tag function). `new (Abc(4, 5, 6))(1, 2, 3)` starts looking pretty good. :-) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Bind function without thisArg

2019-01-14 Thread T.J. Crowder
for boundThis. But I'd be interested to know how difficult it is for JavaScript engines to implement, since Empty is largely a spec-level concept and it's valid (in strict mode) to use `null` and `undefined` as boundThis... -- T.J. Crowder ___ es-discuss

Re: Native Assertions

2019-01-14 Thread T.J. Crowder
luated if the assertion failed, as though you'd written: ```js if (a !== b) { throw new AssertionError(`a (${a}) !== b (${b})`); } ``` -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Array.create and Function.create

2019-01-10 Thread T.J. Crowder
e containers without their usual features seems like a bad idea^H^H^H^H^H^H^H^H edge case best handled by `setPrototypeOf` and `delete`. :-) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

2019-01-09 Thread T.J. Crowder
se the array from the first call to call the tag function the second time, what if the function modified the array? (Presumably if it *is* a change, that's *why* it was changed... :- ) ) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

2019-01-09 Thread T.J. Crowder
`bar`}; ``` ...but this failing: ```js const obj = {`I have a space ${x}`: `bar`}; ``` ...because that's not a NoSubstitutionTemplate and so it needs to be a computed property name. Are there other places? -- T.J. Crowder ___ es-discuss mailing l

Re: String identity template tag

2018-12-14 Thread T.J. Crowder
e end. It won't come up in the simple use case of passing along the strings and subs in a tag function (`subs` will always have one fewer entry than `strings`), but it's slightly more general-purpose if it tacks them on the end. `String.interpolate` wo

Re: String identity template tag

2018-12-13 Thread T.J. Crowder
On Thu, Dec 13, 2018 at 6:37 PM T.J. Crowder wrote: > > But called normally, it's a useful helper, for instance in > Isiah's `escape`... Going through the process of the example for my message just now made me think more about this function. Suppose it: 1. Accepted an array of subs

Re: String identity template tag

2018-12-13 Thread T.J. Crowder
On Thu, Dec 13, 2018 at 5:56 PM Mark Miller wrote: > > I like String.cooked best. While I agree that method names should > generally be verbs, I suggest this rule should *not* be used for > template literal tag names. Fair enough, but the primary use of this function is *not* using it as a tag

Re: String identity template tag

2018-12-13 Thread T.J. Crowder
t some point, or investigations have proved it's not worth the trouble.) I'm not bothered either way. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: String identity template tag

2018-12-13 Thread T.J. Crowder
. There don't seem to be concerns that it's half-baked. (I'll stop now.) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: String identity template tag

2018-12-12 Thread T.J. Crowder
strings already work well enough. Agreed. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: String identity template tag

2018-12-11 Thread T.J. Crowder
it would be an optimization target (being a standard operation). I find the name `identity` unilluminating, though, partially because it's not quite the same meaning as the usual "identity" function (`function identity(x) { return x; }`), though it's close. `assemble

Re: What is holding back Decorators ?

2018-12-04 Thread T.J. Crowder
On Tue, Dec 4, 2018 at 7:08 PM T.J. Crowder wrote: > > I believe there already is one: > https://github.com/tc39/proposal-decorators/issues/69 Apparently there was a poll (**really** wish someone had mentioned it here, following ALL contributors to proposals on twitter is not scalabl

Re: What is holding back Decorators ?

2018-12-04 Thread T.J. Crowder
t further. But it all starts, to my mind, with that thorough read, and respect for those who've been in this trench for some years now. :-) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Callable objects protocol

2018-12-04 Thread T.J. Crowder
but it doesn't really buy you anything. Be interested to know more about why you want non-function callable objects. -- T.J. Crowder [1]: http://jsfiddle.net/8qvpc7Lh/ ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: What is holding back Decorators ?

2018-12-04 Thread T.J. Crowder
you put `export` in front of it" (in the simple case). Breaking that for decorated classes seems like a horrible idea. TC39 is meeting this week. Here's hoping they come to resolution on this stuff and, as is usually the case, a good one that makes sense. -- T.J. Crowder ___

Re: What is holding back Decorators ?

2018-12-04 Thread T.J. Crowder
r/educators/notes-2018-10-11.md -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Proposal for faster this assignments in constructor functions

2018-12-01 Thread T.J. Crowder
On Fri, Nov 30, 2018 at 5:49 PM T.J. Crowder wrote: > which is > > ```js > class Example { > ... > } Apologies, that "which is" at the end of my previous message should have been: ```js class Example { second; #third; fifth; constructor(first,

Re: Proposal for faster this assignments in constructor functions

2018-11-30 Thread T.J. Crowder
list I'd design without a really, really good reason, but... Food for thought. -- T.J. Crowder [1]: https://github.com/tc39/proposal-class-fields/ ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Proposal for faster this assignments in constructor functions

2018-11-29 Thread T.J. Crowder
been true of all of the suggestsions in this thread). -- T.J. Crowder [1]: https://github.com/rtm/js-pick-notation ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: New: proposal-safe-prototype

2018-11-27 Thread T.J. Crowder
be so project-specific that it's unlikely to go into the standard library. I'll step back at this point. Best, -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: New: proposal-known-keys

2018-11-26 Thread T.J. Crowder
On Tue, Nov 27, 2018 at 5:14 AM Ranando King wrote: Do you have any evidence to back up the assertions in the Motivation section? I haven't seen an issue with people making odd design decisions "just" to make properties own properties. -- T.

Re: New: proposal-safe-prototype

2018-11-26 Thread T.J. Crowder
use a Proxy, or... -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: New: proposal-safe-prototype

2018-11-26 Thread T.J. Crowder
le.log(e2.x.y); // 0 ``` Once decorators are up and running, doing this could be a decorator, though I submit it's an edge case. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Numeric Array prototypes

2018-11-22 Thread T.J. Crowder
On Thu, Nov 22, 2018 at 3:48 AM kai zhu wrote: > the spread operator was a mistake. It's neither an operator nor a mistake. Again, please stop wasting the list's time with re-litigating decisions that have been made. -- T.J. Crowder ___ es-disc

Re: Numeric Array prototypes

2018-11-21 Thread T.J. Crowder
rtant from a performance perspective, I'd expect it to get aggressively optimized. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Arrow methods

2018-11-18 Thread T.J. Crowder
benefit to that syntax, since people use class fields for that use-case which can make mocking difficult. But I'm not keen on that syntax with the semantics you're proposing. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Arrow methods

2018-11-18 Thread T.J. Crowder
alizer [but *not* when assigned to a property on an existing object].) ;-) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Cascade operator proposal — native fluent interfaces

2018-11-12 Thread T.J. Crowder
to numeric literals (e.g., `console.log(12..toString())`). I can see in your commit on the Babel fork that you have allowed for it, but for those who don't dig that deep... If this were in the language, I'd happily use it. I don't really feel the lack of it, though. -- T.J. Crowder

Re: Module Namespace Objects - "writable"

2018-10-24 Thread T.J. Crowder
Oooh, I see. Fantastic, thank you Mark and Logan! -- T.J. Crowder On Wed, Oct 24, 2018 at 7:03 PM Mark Miller wrote: > Ah. Crossed in the mail. Yes, Alan raises the same issues regarding the > TDZ vs non-writable worry. > > Thanks for the pointer. > > On Wed, Oct 24, 2018

Module Namespace Objects - "writable"

2018-10-24 Thread T.J. Crowder
e thing was `writable: true` rather than `writable: false`. How'd I do? :-) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Array.prototype.remove(item)

2018-10-11 Thread T.J. Crowder
On Thu, Oct 11, 2018 at 10:59 AM Andrea Giammarchi wrote: > TBH, for consistency sake with everything else in JS, I'd call > the method `delete`, since it's the one that returns `true` or > `false` in pretty much every other case. E.g., in Maps and Sets (and their weak cousins)

Re: Shared memory sync/update question

2018-10-11 Thread T.J. Crowder
s is by intent so as to allow data to be written and > read with cheap unsynchronized writes and reads, and then for > the (comparatively expensive) synchronization to ensure proper > observability. Fantastic, that's exactly what I was hoping. Thank you again! -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Backstory/rationale for disallowing -0 in Map keys and Sets?

2018-10-10 Thread T.J. Crowder
On Wed, Oct 10, 2018 at 7:03 PM Allen Wirfs-Brock wrote: > Yes, exactly. Thanks! -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Backstory/rationale for disallowing -0 in Map keys and Sets?

2018-10-10 Thread T.J. Crowder
s `"0"` for both, for instance; operations involving them largely don't care about the pseudo-sign of 0). Is that the rationale? Basically, avoid a footgun while ensuring consistency? Thanks, -- T.J. Crowder [1]: https://tc39.github.io/ecma262/#sec-map.prototype.set [2]: https://tc39.

Comma-separated instance field definitions

2018-10-08 Thread T.J. Crowder
he syntaxes to align, I'm just curious where the syntax is headed.) -- T.J. Crowder [1]: https://github.com/tc39/proposal-class-fields [2]: https://github.com/tc39/proposal-class-fields/commit/4bfde40926d303694b7acd071c13a610ffa1a272 ___ es-discus

Re: Shared memory sync/update question

2018-10-02 Thread T.J. Crowder
y be read directly. That's also a "synchronization edge"? Thank you again, I appreciate your taking the time. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Shared memory sync/update question

2018-09-23 Thread T.J. Crowder
o believe I'm just being dense (in fact, it seems likely), if someone wants to point out a speciific bit... :-) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: [nodejs] Re: javascript vision thing

2018-09-23 Thread T.J. Crowder
a bit surprised that a list admin hasn't dealt with it yet. It's been allowed to go on for far too long. As always, constructive input on something being proposed is great. Constantly banging on that everything since ES5 made life worse is just noise (and would be even if it were true). -- T.J

Re: Shared memory sync/update question

2018-09-23 Thread T.J. Crowder
that doesn't happen with JavaScript's memory model? That seems unlikely to me, I'd want a canonical source on it. But I could imagine (and this is pure invention) that using an `Atomics` method on a buffer, in addition to ensuring no reordering etc., also triggers a cache-flushing event or similar. -- T.J. C

Shared memory sync/update question

2018-09-22 Thread T.J. Crowder
in advance, -- T.J. Crowder [1]: https://stackoverflow.com/questions/52445807/does-postmessage-or-yielding-to-the-event-loop-or-similar-sync-shared-memory [2]: https://hacks.mozilla.org/2016/05/a-taste-of-javascripts-new-parallel-primitives/ ___ es-discuss

Re: Is this really the most direct way to get %AsyncIteratorPrototype%?

2018-08-14 Thread T.J. Crowder
On Tue, Aug 14, 2018 at 7:42 PM, T.J. Crowder wrote: > I must be misreading those or something, but as far as I can > tell, they both (I think they're basically the same thing) > just give you a specific generator object, not > %AsyncIteratorPrototype%: http://jsfiddle.net/urv04L

Re: Is this really the most direct way to get %AsyncIteratorPrototype%?

2018-08-14 Thread T.J. Crowder
ically the same thing) just give you a specific generator object, not %AsyncIteratorPrototype%: http://jsfiddle.net/urv04Lp7/ -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Is this really the most direct way to get %AsyncIteratorPrototype%?

2018-08-14 Thread T.J. Crowder
globally exposed like `Function` is. None of the new subclasses of Function constructors are exposed; according to [this thread][1], there weren't enough strong use cases [that thread is for `GeneratorFunction`, but we can extrapolate].) -- T.J. Crowder [1]: https://esdiscuss.org/topic/why

Re: JSON support for BigInt in Chrome/V8

2018-07-29 Thread T.J. Crowder
is unambiguous and offers a path to extendibility, but Date already goes a different way...) This parallels Date handling and seems a reasonable stop-gap until the next thing after JSON. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.or

Re: JSON support for BigInt in Chrome/V8

2018-07-26 Thread T.J. Crowder
SON` which validated and parsed the string in that format. This would put us where Dates are now, but without competing standards for them (ISO string vs.` /Date(epochval)/`). -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org http

Re: javascript vision thing

2018-07-26 Thread T.J. Crowder
pt's features is nothing new. JSON doesn't handle Date instances, Maps, Sets, or Symbols as values either (much less Symbols as keys). But JSON support for BigInt (or BitInt support JSON, whatever) is something to pick up in [its thread][1], not here. -- T.J. Crowder [1]: https://esdiscuss.org/topic

Re: proposal: Object Members

2018-07-26 Thread T.J. Crowder
ful. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: [proposal] Object.pick

2018-07-26 Thread T.J. Crowder
const {first, age} = person; result = {first, age}; } ``` If/when `do` expressions: ```js const result = do { const {first, age} = person; ({first, age}); }; ``` None of which is pretty either. :-) -- T.J. Crowder ___ es-discuss mailing li

Re: [proposal] Persistent variables in functions/methods

2018-07-25 Thread T.J. Crowder
On Wed, Jul 25, 2018 at 12:02 PM, Herbert Vojčík wrote: > If we get do expressions, we can, afaict, simply do... Very good point. It's nicely concise, too. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.

Re: javascript vision thing

2018-07-25 Thread T.J. Crowder
ad horse. I'm not going to keep writing these replies, I'll just refer to this one from now on. And again, lurkers, please weigh in. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: proposal: Object Members

2018-07-25 Thread T.J. Crowder
ding your intent? -- T.J. Crowder [1]: https://github.com/tc39/proposal-class-fields [2]: https://github.com/tc39/proposal-static-class-features/ ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Polyfilling Object.observe

2018-07-25 Thread T.J. Crowder
(or possibly both entry and exit) or when the application code asked it to. I think this thread is getting fairly off-topic for this list, though. Perhaps do up a full runnable MCVE and post a Stack Overflow question or similar. Good luck with it! --

Re: Polyfilling Object.observe

2018-07-24 Thread T.J. Crowder
, is the current parlance?), and if you want notifications of changes just to those properties, I think monkeypatching will be your simplest and most successful approach. If you need to catch additions as well, I don't think there's any solution other than diffing, which is quit

Re: javascript vision thing

2018-07-24 Thread T.J. Crowder
ut again: I'm sure constructive, research-based input on how to deal with JSON issues related to (for instance) BigInt would be welcome in that BigInt thread and, ideally, eventually a proposal. There's no need for some big conceptual argument over the course of the language -- that *is* a

Re: proposal: Object Members

2018-07-24 Thread T.J. Crowder
anything but sugar. The accurate statement would be that `class` lets you do things you couldn't do in ES5. But so does `Reflect.construct`. I believe it was important to the "no `new`" crowd that a non-`class` mechanism existed for creating objects using Error and Array as prototype

Re: Small Proposal "!in"

2018-07-24 Thread T.J. Crowder
On Tue, Jul 24, 2018 at 12:28 AM, Steve Fink wrote: > Or perhaps `in.own` should be Object.prototype.hasOwnProperty.call(obj, > prop)? It should just use the abstract [HasOwnProperty][1] operation directly. -- T.J. Crowder [1]: https://tc39.github.io/ecma262/#sec-hasownpr

Re: const {resolve} = Promise; // fails

2018-07-19 Thread T.J. Crowder
Either subclassers would have to handle that, which they will forget to do, or it has to be a bit more complicated than just a simple fallback to ` Promise` (I don't immediately know what that "more complicated" answer would be.) -- T.J. Crowder ___ es

Re: Small Proposal "!in"

2018-07-19 Thread T.J. Crowder
On Thu, Jul 19, 2018 at 2:44 PM, T.J. Crowder < tj.crow...@farsightsoftware.com> wrote: > Is there anyone appropriately-placed who can say "Yeah, if someone spends > the time to investigate this and put together a really proper proposal, I'm > willing to look at that proposa

Re: Small Proposal "!in"

2018-07-19 Thread T.J. Crowder
On Thu, Jul 19, 2018 at 12:32 PM, Andy Earnshaw wrote: > Although I support the idea of `!in` (for the same reasons as T.J. Crowder > mentioned, plus it's useful for duck typing), what some browsers do isn't a > great argument as modern browsers follow the spec more closely wit

Re: Feature proposal

2018-07-19 Thread T.J. Crowder
On Thu, Jul 19, 2018 at 9:49 AM, Isiah Meadows wrote: > What about this alternate proposal: Great minds: https://esdiscuss.org/topic/fwd-feature-proposal#content-5 ;-) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org ht

Re: Feature proposal

2018-07-18 Thread T.J. Crowder
the original array). But it does with `forEach`, `find`, `some`, etc.: ```js const objects = [ {id: 1, type: 1}, {id: 2, type: 2}, {id: 3, type: 2}, {id: 4, type: 3} ]; console.log(reversedView(objects).find(o => o.type === 2)); ``` Finds `{id: 3, type:

Re: Feature proposal

2018-07-18 Thread T.J. Crowder
nd ES2015): * Lodash implements both `findLastIndex` and `findLast`). * Underscore, PrototypeJS, and MooTools don't as far as I can see from the docs. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Re: [proposal] Persistent variables in functions/methods

2018-07-17 Thread T.J. Crowder
return n * a; }; return foo(n); } ``` Again, I really don't like that, but it does defer init. Given how easy this is with block scope or, as Ben Wiley points out, module scope, I think there would need to be a stronger use case. -- T.J. Crowder _

Re: Small Proposal "!in"

2018-07-11 Thread T.J. Crowder
wrote: > So I agree this is a Really Bad Idea™, for this above if not the Kotlin > reference. I strongly disagree it's a Really Bad Idea™. I think it's a Moderately Good Idea On The Whole™. And `!in` is fine by me but I'm also happy with `notin` or whatever. I just don't expect it to happen.

Re: Array.prototype.replace

2018-07-10 Thread T.J. Crowder
e > might not be. Heh, whereas despite having written that first bullet in the footgun column somewhat forcefully (looking back), I go the other way. :-) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Array.prototype.replace

2018-07-10 Thread T.J. Crowder
lity about it. In the YAGNI and/or footgun column: * People already get objects and arrays confused enough! At least right now, if they write `[foo: "bar"]`, they get a syntax error (though of course `{0: "bar"}` is perfectly valid). Don't hand them yet another footgun. * As you sa

Re: Array.prototype.replace

2018-07-10 Thread T.J. Crowder
(array); // [, , 42]; ``` -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Small Proposal "!in"

2018-06-28 Thread T.J. Crowder
js if (!('x' in obj || 'y' in obj)) { doit() } ``` That said, I've wanted !in many a time, in a minor sort of way... -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: [Proposal] ignoreCase method

2018-06-27 Thread T.J. Crowder
every time you need to do a case-insensitive comparison; instead, I'd drop a utility function in my standard lib somewhere. I like that approach to creating that utility function, though. :-) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org

Re: Re: [Proposal] ignoreCase method

2018-06-27 Thread T.J. Crowder
hotspot for execution, it'll get aggressively optimized either way. If it isn't, you don't care. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Re: [Proposal] ignoreCase method

2018-06-27 Thread T.J. Crowder
t just that the strings are equal or not equal, but how they relate to one another lexicographically. For instance, for sorting: ```js const array = ["c", "a", "B"]; array.sort((a, b) => a.localeCompare(b, undefined, {sensitivity: "base"})); console.

Re: [Proposal] New syntax for lazy getters

2018-06-12 Thread T.J. Crowder
larly, this should be > invalid. > } Andrea was using syntax from the [class fields proposal][1], currently at Stage 3 and fairly commonly used via transpilation (he said "class fields" later in the post, but didn't emphasize it). -- T.J. Crowder [1]: https://git

Re: Symbol history

2018-05-29 Thread T.J. Crowder
at's as much detail as I need to get into. Thanks again all! -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Symbol history

2018-05-28 Thread T.J. Crowder
but having guaranteed-unique values was still useful, and found application (amongst other places) in solving the problem of adding a default iterator to `Array.prototype` without name conflicts with existing code in the wild? Thanks, -- T.J. Crowder ___

Re: Array.prototype.append ?

2018-05-25 Thread T.J. Crowder
On Fri, May 25, 2018 at 1:58 PM, Isiah Meadows <isiahmead...@gmail.com> wrote: > I'm aware > that if you assume it's an array, the length will update itself, but > it won't on array-likes. Ah, fair enough, supporting array-likes. -- T.J. Crowder ___

Re: Array.prototype.append ?

2018-05-25 Thread T.J. Crowder
wanting a version of `push` that returns the array. `pushAll` looks good to me. (Re the desugared code: You don't need that `this.length = index` at the end, though. :-) ) -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Array.prototype.append ?

2018-05-24 Thread T.J. Crowder
* Firefox v60: 500k - 510k * Edge v41: 650k - 660k * IE11: 250k - 260k * IE8¹: 5.25M (!) - 5.26M Using `dest.push(...source)` [instead][2] gave the same numbers as above on Chrome, Firefox, and Edge. So two reasons: Returning the array, and not pushing (no pun) the limit. ~125k entries isn't all th

Re: es-discuss Digest, Vol 135, Issue 48

2018-05-24 Thread T.J. Crowder
We have two threads going on this with the same (and differeing) points being raised in both, let's pick it up in the better-named ["Array.prototype.append?" thread](https://esdiscuss.org/topic/array-prototype-append). -- T.J. Crowder Farsight Software Ltd | 20-22 Wenlock Road, Lon

Re: Array.prototype.append ?

2018-05-23 Thread T.J. Crowder
as are given, as with `push`: ```js Object.defineProperty(Array.prototype, "append", { value: function(...items) { for (let i = 0, len = source.length; i < len; ++i) { this.push(item[i]); } return this;

Re: es-discuss Digest, Vol 135, Issue 48

2018-05-23 Thread T.J. Crowder
tions. This version assumes all entries are array-like and should have their entries added to the array on which it's called. There are a lot of other designs one could make, though. Just one argument (you can always chain); a flattening version; etc., etc. -- T.J. Crowder ___

Re: Embarrassingly Simple Spec Question

2018-05-23 Thread T.J. Crowder
were to try to expand everything.) Yeah, this is just a weak area for me. Apologies all. I should have just kept clicking, but when I got to *BitwiseXORExpression* I figured I *had* to be off-piste. ;-) -- T.J. Crowder ___ es-discuss mailing list es-disc

Re: Embarrassingly Simple Spec Question

2018-05-22 Thread T.J. Crowder
od reason not to include *PrimaryExpression* in *AssignmentExpression* directly (ambiguity or some such). **Thanks!!** -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Embarrassingly Simple Spec Question

2018-05-22 Thread T.J. Crowder
t, and I'm sure it isn't for a reason. It's a dead simple thing, clearly (and embarrassingly) there's just some fundamental point or concept I'm missing. Thanks in advance, -- T.J. Crowder [1]: https://tc39.github.io/ecma262/#sec-assignment-operators [2]: https://tc39.github.io/ecma262/#prod-A

Re: Re: Proposal: Phase-Invariant Einno Soliton Templates

2018-05-21 Thread T.J. Crowder
tc39/proposals). It's going to take accepting that if *you're* not sure something is useful, if you can't present a compelling use case that benefits a significant fraction of JavaScript programmers, then spending your time and ours writing it up and posting it to the list is actively counte

Re: Adding .map() directly to String prototype

2018-05-17 Thread T.J. Crowder
with combining marks. If it's a pain point for someone, they can always propose a locale-specific mapping function standard, perhaps for ECMA-402... -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Adding .map() directly to String prototype

2018-05-17 Thread T.J. Crowder
n? If so, the footgun available (iterating code units rather than codepoints), could be an argument in favor... -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Adding .map() directly to String prototype

2018-05-17 Thread T.J. Crowder
`.map` added, it would presumably visit characters, not code units, as well; it would be the only reasonable thing to do, both in light of how strings iterate and just general utility/appropriateness. -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozil

Re: Dynamic `import` with options

2018-05-09 Thread T.J. Crowder
y’d all made a big mistake in coming down from the trees in the first place. And some said that even the trees had been a bad move, and that no one should ever have left the oceans. *(With apologies to Douglas Adams)* -- T.J. Crowder ___ es-discuss mai

Re: Proposal: Inline javascript

2018-05-08 Thread T.J. Crowder
uot;basenet": [ "supernet": gpi = new Network().typeOf({ starTopology:[[0,1,..],[2,3,..],..] }) ] ]; ``` ...which do the same thing? Does this call on any prior art? What problems does it solve? -- T.J. Crowder On Tue, May 8, 2018 at 10:53 AM, Abdul Shabazz <ahshabazz2

Re: Accessing (n)th key from an object

2018-04-24 Thread T.J. Crowder
s almost always a bad idea. @somonek, an object with an array of keys is probably your best solution. Wrap it up in an object with an API that all of the code updating it can use, so you don't have consistency issues. You could even give it an iterator. :-) -- T.J. Crowder _

Re: Accessing (n)th key from an object

2018-04-24 Thread T.J. Crowder
.but I don't think that, or `keysIterator`, really helps somonek vs. what he's doing now (`Object.keys`). -- T.J. Crowder [1]: https://tc39.github.io/ecma262/#sec-enumerate-object-properties ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: ECMA site down

2018-04-24 Thread T.J. Crowder
ed outage, but clearly someone's on it (now). -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Accessing (n)th key from an object

2018-04-24 Thread T.J. Crowder
casions, the way I'd use would be `["whateverName", whateverName]` (granted it's more verbose at the call site). That's what `Object.entries` and `Map.prototype.entries` do, for instance, and it's friendly to destructuring: ```js function example([name, value]) { console.log(`${name} = ${value}`)

Re: Accessing (n)th key from an object

2018-04-24 Thread T.J. Crowder
n so I can't check the 2016 or 2017 snapshots [note to self: keep local copies!]). Agreed it's not the best way to go about it, though. :-) -- T.J. Crowder [1]: https://tc39.github.io/ecma262/#sec-object-type ___ es-discuss mailing list es-discuss

Re: Accessing (n)th key from an object

2018-04-24 Thread T.J. Crowder
the first two. Also has the advantage that you can easily change how many you show before the "See more." -- T.J. Crowder On Tue, Apr 24, 2018 at 3:41 PM, somonek <somo...@gmail.com> wrote: > The use case is: > (long story short) > > I have an array of items coming fr

  1   2   3   4   >