Re: Proposal: Property Accessor Function Shorthand

2019-12-09 Thread Tab Atkins Jr.
On Sat, Dec 7, 2019 at 2:01 PM wrote: >> I do find it surprising that property access isn't addressed there, >> but it seems like it was likely just overlooked - it has no mention in >> the repo, in the open issues, or even in the closed issues or any of >> the open or closed pull requests. > >

Re: function invocation with just commas for explicit undefined optional arguments in the middle

2019-10-29 Thread Tab Atkins Jr.
On Tue, Oct 29, 2019 at 9:06 AM manuelbarzi wrote: > ``` > fun('a', 'b',, 'd',, 'f') > ``` While this does technically match up with arrays, I find the the array behavior unreadable and unintuitive (especially with the exception for the final comma), and I'd prefer that syntax quirk not spread

Re: Conditional await, anyone?

2019-10-14 Thread Tab Atkins Jr.
On Sat, Oct 12, 2019 at 7:19 AM Andrea Giammarchi wrote: > in order to work, `await` must be executed in an async scope/context (either > top level or within a closure). > > In such case, either somebody is awaiting the result of that `async` > execution, or the order doesn't matter. That's

Re: Re: Modify Promise.all() to accept an Object as a parameter

2019-10-14 Thread Tab Atkins Jr.
On Fri, Oct 11, 2019 at 9:53 PM Jacob Bloom wrote: > What about special handling for Maps? Maybe something like > > ``` > const requests = new Map(); > requests.set('reqA', fetch('...')); > requests.set('reqB', fetch('...')); > const responses = await Promise.all(requests); > console.log( >

Re: Conditional await, anyone?

2019-10-11 Thread Tab Atkins Jr.
On Fri, Oct 11, 2019 at 1:15 AM Andrea Giammarchi wrote: > Again, the `await?` is sugar for the following: > > ```js > const value = await? callback(); > > // as sugar for > let value = callback(); > if ('then' in value) > value = await value; > ``` Okay, so that has the "you can't predict

Re: Conditional await, anyone?

2019-10-10 Thread Tab Atkins Jr.
On Wed, Oct 9, 2019 at 11:17 PM Andrea Giammarchi wrote: > > What's the order of the logs? > > Exactly the same, as the `await?` is inevitably inside an `async` function > which would grant a single microtask instead of N. I think you're misreading my example? Check this out:

Re: Conditional await, anyone?

2019-10-09 Thread Tab Atkins Jr.
On Wed, Oct 9, 2019 at 12:08 AM Andrea Giammarchi wrote: > I don't know why this went in a completely unrelated direction so ... I'll > try to explain again what is `await?` about. Nah, we got it. Our complaint was still about the semantics. > ```js > const value = await? callback(); > > // as

Re: Conditional await, anyone?

2019-10-08 Thread Tab Atkins Jr.
I'm not sure I understand the intended use-case here. If the author knows the function they're calling is async, they can use `await` normally. If they know it's not async, they can avoid `await` altogether. If they have no idea whether it's async or not, that means they just don't understand

Re: Optional chaining syntax but with the "mice" operator ?

2019-09-06 Thread Tab Atkins Jr.
On Fri, Sep 6, 2019 at 8:04 AM Andrea Giammarchi wrote: > Indeed I'm not super convinced myself about the "branching issue" 'cause > `const result = this?.is?.branching?.already` and all I am proposing is to > hint the syntax where to stop in case something else fails down the line, as > in

Re: Optional chaining syntax but with the "mice" operator ?

2019-09-05 Thread Tab Atkins Jr.
On Thu, Sep 5, 2019 at 2:39 PM Andrea Giammarchi wrote: > > This is basically a solution to a common problem we have these days, where > modules published in the wild might have a `default` property, to support ESM > logic, or not. > > ```js > // current optional chaining logic > const imported

Re: Proposal: `String.prototype.codePointCount`

2019-08-08 Thread Tab Atkins Jr.
On Thu, Aug 8, 2019 at 2:45 AM Claude Pache wrote: > In fact, for my purpose, I have no reason to impose a limit for a precise > number of *code points* (as opposed to other possible definitions of “length” > such as *UTF-16 code units* or *grapheme clusters*). Technically, I am > usually

Re: Proposal: 1) Number (integer or decimal) to Array 2) Array to Number (integer or decimal)

2019-03-10 Thread Tab Atkins Jr.
On Sat, Mar 9, 2019 at 11:10 AM Felipe Nascimento de Moura wrote: > > Personally, I don't think it would be THAT useful... > but...I think there is something behind this proposal that makes sense. > > I do believe it could be useful for developers to have an easier access to > number parts or

Re: add stage4 constraint - ease-of-minification

2019-02-12 Thread Tab Atkins Jr.
On Tue, Feb 12, 2019 at 7:44 AM kai zhu wrote: > i think there’s an industry-painpoint (at least from my experience), of > resistance adopting es6+ features because legacy-toolchains cannot be easily > retooled to minify them. > > i’m not sure the best way to address this problem? i favor

Re: De-structuring array arguments

2019-01-17 Thread Tab Atkins Jr.
On Thu, Jan 17, 2019 at 1:36 PM Jordan Harband wrote: > I'm not sure what you mean, that should certainly be possible today. In node, > I get this: > > ``` > function foo ([a, b] = [1, 2]) { return [a, b]; } > foo([2, 3]) // [2, 3] > foo() // [1, 2] > ``` Yup, and you get the same in browsers.

Re: Proposal: Placeholder operator

2019-01-11 Thread Tab Atkins Jr.
On Fri, Jan 11, 2019 at 6:42 AM Sultan wrote: > >empty space with a comma? > > I think that only works with trailing params. For example this is not > possible: > > const foo = (a, , c) => {} It doesn't even "work" with trailing params. Function arglists can *contain* a trailing comma, it's

Re: New Proposal: Number.range (Yes, range again)

2018-11-28 Thread Tab Atkins Jr.
I end up writing a range function in virtually every project I use, so yeah, I think this is worthwhile. My own preferences, based on Python precedence: Number.range(end) === Number.range(0, end, 1) Number.range(start, end) === Number.range(start, end, Math.sign(end-start)) Number.range(start,

Re: New Proposal: Placeholder syntax

2018-11-28 Thread Tab Atkins Jr.
Aside from the fact that this "placeholder" proposal addresses the "receiver" and "operator" cases that partial-application explicitly omits, the two proposals are exactly identical. They're not "complementary", they're the same thing, just making a different decision wrt complexity of some of the

Re: deprecate .add/removeEventListener(...) in pro of .on/off(...)

2018-11-28 Thread Tab Atkins Jr.
Jordan meant that DOM isn't part of the JS standard. ^_^ So yeah, not relevant to this list. On Wed, Nov 28, 2018 at 11:39 AM Isiah Meadows wrote: > > It *is* part of the DOM itself: > https://dom.spec.whatwg.org/#interface-eventtarget. Doesn't make this > any more on-topic here, though. > >

Re: Arrow methods

2018-11-16 Thread Tab Atkins Jr.
On Fri, Nov 16, 2018 at 12:42 PM Sultan wrote: > > Consistency and sugar. Changing from arrow and non-arrow method is a diff > between `=>` where: > > foo() {} mirrors foo: function () {} > foo() => {} mirrors foo: () => {} Yes, but note that the first one *actually contains sugar* - it lets

Re: Proposal: `maxDepth` on objects

2018-10-22 Thread Tab Atkins Jr.
On Mon, Oct 22, 2018 at 2:42 AM Rob Ede wrote: > Calculating this on plain objects could be a O(1) operation: > > Empty objects are initialized with maxDepth 0 and are set to 1 when a > primitive property is added. > If an object property is added the maxDepth is set to 1 + >

Re: Why isn't `Promise.all()` overloaded?

2018-08-10 Thread Tab Atkins Jr.
On Fri, Aug 10, 2018 at 2:30 PM Jacob Pratt wrote: > This is potentially a very simple question, `Promise.all()` takes a single > iterable as a parameter. Is there any particularly reason it wasn't > overloaded to allow passing multiple parameters (and use `...arguments`)? Of > course, the

Re: !Re: proposal: Object Members

2018-08-03 Thread Tab Atkins Jr.
On Fri, Aug 3, 2018 at 2:33 PM Ranando King wrote: > > A side thought: > > If a language reserving certain words, even to the point of generating error > messages related to using them under certain circumstances, doesn't > constitute at least part of a justification for using them, then why do

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

2018-05-23 Thread Tab Atkins Jr.
On Wed, May 23, 2018 at 1:05 PM, Jordan Harband wrote: > `array.push(...sources)`, not sure why we'd need "append". >From the original email (a bit buried and hard to find due to broken threading, admittedly): > Has anyone ever suggested Array.prototype.append as an

Re: Proposal: Add a global Infinitesimal property

2018-05-14 Thread Tab Atkins Jr.
On Sat, May 12, 2018 at 9:49 AM, Abdul Shabazz wrote: > As polar opposite to Infinity, Number.POSITIVE_INFINITY, the Infinitesimal > should be a smallest representable value greater than 0. Perhaps someone > else could propose why this would be useful. Please stop

Re: Re: Proposal: Array.prototype.shuffle (Fisher-Yates)

2018-04-29 Thread Tab Atkins Jr.
On Sun, Apr 29, 2018 at 4:31 PM, J Decker wrote: > I can see that's certainly something that can be gotten wrong; the in-place > sort is kind-of nice; but you end up hitting most numbers twice, and with a > longer array (say a set of 75 bingo balls) you can move the same number

Re: Re: Proposal: Array.prototype.shuffle (Fisher-Yates)

2018-04-29 Thread Tab Atkins Jr.
On Sun, Apr 29, 2018 at 10:01 AM, Isiah Meadows wrote: > I think this would be better suited for a library function rather than > a language feature. I could see this also being useful also for > randomized displays, but that's about it. And I'm not sure what an > engine

Re: Proposal: Allow Promise callbacks to be removed

2018-04-23 Thread Tab Atkins Jr.
On Mon, Apr 23, 2018 at 10:56 AM, Oliver Dunk wrote: > My proposal is that we add a way of removing a particular callback, or all > callbacks, from a Promise. This is different to cancelling a Promise and > would instead happen if you want the operation to continue but

Re: [strawman] Symbol.thenable proposal

2018-04-16 Thread Tab Atkins Jr.
On Fri, Apr 13, 2018 at 6:00 PM, Isiah Meadows wrote: > I can't remember where, but I recall seeing this discussed elsewhere > (maybe in the TC39 meeting notes?) and the conclusion was basically > ¯\_(ツ)_/¯. I'm not convinced myself it's actually worth the extra > symbol

Re: EcmaScript Proposal - Promised functions

2018-04-12 Thread Tab Atkins Jr.
On Thu, Apr 12, 2018 at 9:07 AM, Luiz Felipe Frazão Gonçalves wrote: > One new proposal for EcmaScript. > > Promised Functions > > Like async/await, the promised functions would be preceded by a keyword. In > the case, promised, it would change the default

Re: partial spread syntax

2018-03-25 Thread Tab Atkins Jr.
On Sun, Mar 25, 2018 at 6:20 PM, 月の影 <19511...@qq.com> wrote: > Sometimes I got a infinity iterable sequences, I may want a partial spreed > syntax. `...iterableObject{from, to}` > > For example: > > ```js > function *fibonacci() { > let a = 0, b = 1 > while(1) { > [a, b] = [b, a +

Re: Operator for Currying

2018-03-22 Thread Tab Atkins Jr.
While I love currying in many languages, I have some reservations about it being generally useful enough in JS to be worth adding syntax for. 1. Currying isn't friendly with variadic functions (that is, optional arguments) - you can't tell when the function has consumed "enough" arguments to

Re: Expanding Object Shorthand

2018-03-16 Thread Tab Atkins Jr.
On Fri, Mar 16, 2018 at 1:58 PM, Sebastian Malton wrote: > Yes that is possible but what if you want to do the following? > > ``` > var a = { > b: B.b, > c: B.c, > d: B.d, > e: B.e > }; > ``` > > Would it not be easier to do the following? > > ``` > var a =

Re: Expanding Object Shorthand

2018-03-16 Thread Tab Atkins Jr.
On Fri, Mar 16, 2018 at 1:30 PM, Sebastian Malton wrote: > Hello currently the following is a possible way to define an object. > > ``` > var d = { a, b, c }; > ``` > > But this only works if the fields are already variables. > > So if you wanted to select some fields from

Re: Re: Explainer/Spec: Smart pipelines

2018-03-11 Thread Tab Atkins Jr.
On Sun, Mar 11, 2018 at 4:44 PM, Tab Atkins Jr. <jackalm...@gmail.com> wrote: > On Sun, Mar 11, 2018 at 2:36 PM, Peter Jaszkowiak <p.jasz...@gmail.com> wrote: >>> optionally preceded by `new` or `await` >> >> This seems very arbitrary and _not_ forwards-compati

Re: Re: Explainer/Spec: Smart pipelines

2018-03-11 Thread Tab Atkins Jr.
On Sun, Mar 11, 2018 at 2:36 PM, Peter Jaszkowiak wrote: >> To clarify: The way that bare style and topic style are distinguished are >> not by the absence/presence of a topic reference. Bare style has a simple >> and strict syntax: any identifiers, separated by `.`s,

Re: Proposal: then operator for easier promise manipulation

2018-03-03 Thread Tab Atkins Jr.
On Sat, Mar 3, 2018 at 1:04 AM, Bryant Petersen wrote: > The purpose of `await` is to allow synchronous execution within an > async function. > > The purpose of `then` is to make it easier to manipulate the promises > as if they were normal values. It is much closer to >

Re: Proposal: Map#assign

2018-01-18 Thread Tab Atkins Jr.
On Thu, Jan 18, 2018 at 11:25 AM, Peter Jaszkowiak wrote: > Isn't there a proposal for `Map#setAll`? That would fulfill the other use > case. Or, stealing naming from Python, Map#update. (I've asked for this in the past and would be very happy to see it.) ~TJ

Re: Re: Allow specify numbers with suffixes

2017-12-13 Thread Tab Atkins Jr.
On Tue, Dec 12, 2017 at 6:38 PM, Darien Valentine wrote: > The runtime version seems likely to create more confusion than not, too. The > example you gave — `10px + 1em` — demonstrates how that might go. One might > expect that to work because css’s `calc` can do it. But

Re: Array.prototype.mapOn method

2017-10-27 Thread Tab Atkins Jr.
On Fri, Oct 27, 2017 at 8:17 AM, Peter Jaszkowiak wrote: > > Actually flatMap isn't even needed. My question is, why use this over a > normal map with a conditional? It doesn't seem to really save any space. Right. The example given: ``` exampleArray.mapOn(Math.sqrt,

Re: Make comma at the end of line optional

2017-09-13 Thread Tab Atkins Jr.
I believe Bob was engaging in reductio ad absurdum, Isiah. ^_^ On Wed, Sep 13, 2017 at 11:51 AM, Isiah Meadows wrote: > What about... > > - variable (var) > > - donuts (do) > > - forest (for) > > - awaiter (await, module-specific) > > - async

Re: Re: Make comma at the end of line optional

2017-09-12 Thread Tab Atkins Jr.
On Tue, Sep 12, 2017 at 1:49 PM, Алексей wrote: > Think of it from a different way: if there would be no ',' how would you > react on the idea of adding it? Peaty sour every one would decide that would > be a complete nonsense. This sort of hypothetical isn't useful; you're not

Re: super return

2017-08-28 Thread Tab Atkins Jr.
On Mon, Aug 28, 2017 at 1:27 PM, Sebastian Malton wrote: > This could be done but I see a few problems with it: > > 1. Though it does make ending from some functions like forEach able to be > done it does not all returning from other functions like map or sort map() and

Re: super return

2017-08-28 Thread Tab Atkins Jr.
On Mon, Aug 28, 2017 at 12:29 PM, Sebastian Malton 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

Re: Re: Defer expression

2017-08-17 Thread Tab Atkins Jr.
On Thu, Aug 17, 2017 at 12:12 PM, Matthew Robb wrote: > Honestly have there been any proposals for something like `do async { // can > await here }` which would produce a promise in the enclosing scope Do-expressions haven't advanced in general yet, but if/when they do,

Re: an operator for ignoring any exceptions

2017-08-02 Thread Tab Atkins Jr.
On Wed, Aug 2, 2017 at 3:45 AM, T.J. Crowder wrote: > On Wed, Aug 2, 2017 at 4:58 AM, Sheng TIAN wrote: >> Is there any proposal for an one unary operator for ignoring any >> exceptions. >> >> (I have not search out any related threads. But it

Re: Return value of forEach

2017-07-24 Thread Tab Atkins Jr.
On Mon, Jul 24, 2017 at 3:31 PM, T.J. Crowder <tj.crow...@farsightsoftware.com> wrote: > On Mon, Jul 24, 2017 at 9:58 PM, Tab Atkins Jr. <jackalm...@gmail.com> > wrote: >> In general, functions returning undefined are *often* safe to switch >> to returning a more

Re: Re: Add an easier method for slicing and stepping strings and arrays

2017-07-24 Thread Tab Atkins Jr.
On Sun, Jul 23, 2017 at 12:36 AM, Darien Valentine wrote: > Here are some related threads from the past: > > https://esdiscuss.org/topic/negative-indices-for-arrays > https://esdiscuss.org/topic/array-slice-syntax >

Re: Return value of forEach

2017-07-24 Thread Tab Atkins Jr.
On Sun, Jul 23, 2017 at 6:53 AM, Naveen Chawla wrote: > Does anybody have any opinion on a new Array.prototype.each method that does > the same as forEach but returns the array, thereby allowing chaining with > sort, map, filter etc., while also preserving backwards

Re: A twist on functional operatorsr

2017-07-17 Thread Tab Atkins Jr.
On Fri, Jul 14, 2017 at 8:11 PM, Bob Myers wrote: > The proposal to write `arr.reduce((+))`, with `(+)` as an alternative to > `(a, b) => a + b` is admirably concise, but syntactically challenging. I > propose an alternative which is slightly less compact, but hopefully more >

Re: Roman numeral support in Number type

2017-07-11 Thread Tab Atkins Jr.
On Thu, Jul 6, 2017 at 11:29 PM, kdex wrote: > Turns out the largest representable number is 39, > but this might be implementation-specific. Avoiding the more unusual characters is why CSS's roman-numeral list-numbering scheme

Re: setTimeoutAt(cb, date)

2017-07-11 Thread Tab Atkins Jr.
On Sat, Jul 8, 2017 at 12:58 PM, Isiah Meadows wrote: > Previous discussion: > https://esdiscuss.org/topic/standardize-global-settimeout-etc That thread is not relevant to the question at hand. That linked thread is talking about moving the definition of setTimeout()

Re: Intercepting sets on array-like objects

2017-06-09 Thread Tab Atkins Jr.
On Fri, Jun 9, 2017 at 2:07 PM, Domenic Denicola wrote: > I'm not really sure how you're expecting to get an answer "according to > TC39." I was told by Anne in to "go back to TC39 I suppose and say you really

Re: Intercepting sets on array-like objects

2017-06-09 Thread Tab Atkins Jr.
On Fri, Jun 9, 2017 at 1:57 PM, Adam Klein <ad...@chromium.org> wrote: > On Thu, Jun 8, 2017 at 11:32 AM, Tab Atkins Jr. <jackalm...@gmail.com> > wrote: >> Note that if we don't get some variant of this functionality, these >> APIs will instead do one of: >&

Intercepting sets on array-like objects

2017-06-08 Thread Tab Atkins Jr.
Heya! As part of designing the CSS Typed OM , we've ended up with at three (so far) places where we want an interface that represents a list of values: * CSSUnparsedValue ,

Re: Nonconstructors

2017-04-28 Thread Tab Atkins Jr.
On Mon, Apr 24, 2017 at 10:53 PM, Raul-Sebastian Mihăilă <raul.miha...@gmail.com> wrote: > On Tue, Apr 25, 2017 at 12:15 AM, Tab Atkins Jr. <jackalm...@gmail.com> > wrote: >> >> >> The obvious question is, why do you want to use `this`? >> >> ~

Re: Nonconstructors

2017-04-24 Thread Tab Atkins Jr.
On Mon, Apr 24, 2017 at 1:42 PM, Raul-Sebastian Mihăilă wrote: > I have a dilemma. I like how typically the built-in methods are not > constructors (like Array.prototype.forEach). I have cases in which I'm > creating a function in which I want to use `this` but I would

Re: How come resolving a settled Promise doesn't throw?

2017-02-28 Thread Tab Atkins Jr.
On Tue, Feb 28, 2017 at 10:12 AM, /#!/JoePea wrote: > f.e. > > ```js > let resolve > let p = new Promise(r => resolve = r) > > resolve(5) // resolves the promise. > resolve(4) // noop (in Chrome), but why not throw an error? > ``` > > I only tested in Chrome, and I'm assuming it

Re: Enable async/await to work on functions that don't just return promises.

2017-02-27 Thread Tab Atkins Jr.
On Mon, Feb 27, 2017 at 12:41 AM, Isiah Meadows wrote: > May I add one more thing: the main topic this was about is adapting > non-standard async APIs (like Node's error-first callback idiom) to the land > of promises. Async functions and iterators are incredibly useful

Re: Array Comprehensions

2017-02-06 Thread Tab Atkins Jr.
On Mon, Feb 6, 2017 at 9:47 AM, Gil Tayar wrote: > Forgive me if I'm wrong, but the double-for comprehension (e.g. [for (i of > numbers) for (j of letters) i + j]) can't be easily expressed in JS because > there's no flatMap. Correct. (Which is why we need to add it.) Aside:

Re: Ranges

2016-12-13 Thread Tab Atkins Jr.
On Tue, Dec 13, 2016 at 3:07 AM, Hikaru Nakashima wrote: > My idia is as follows: > > ``` > [1..5] //-> [1,2,3,4,5] > > (1..5) //-> iterate 1, 2, 3, 4, 5 > > > [1..Infinity] // -> TypeError because n > 2**32-1 > > (1..Infinity) // -> valid iterator > ``` As Andy

Re: expanding comments proposal

2016-10-21 Thread Tab Atkins Jr.
On Fri, Oct 21, 2016 at 3:20 PM, Gert Cuykens wrote: > First I would like to see if we can agree on the term superset. Like > the question is typescript a superset of ES? As you pointed out there > are many comment like solutions like jsdoc or like your pep 484 >

Re: expanding comments proposal

2016-10-21 Thread Tab Atkins Jr.
On Fri, Oct 21, 2016 at 2:46 PM, Gert Cuykens wrote: > Exactly, here is a concrete ES2015 example > http://jsbin.com/ruqekam/edit?html,output Now just add a simple > typescript type to any of the variables and notice everything breaks. > If ES2015 would be smart enough to

Re: Proposal: add an option to omit prototype of objects created by JSON.parse()

2016-10-06 Thread Tab Atkins Jr.
On Thu, Oct 6, 2016 at 12:50 PM, Rick Waldron wrote: > var o = JSON.parse('{}'); > Object.setPrototypeOf(o, null); That's not remotely correct, as it does nothing for anything other than the top object. (And it breaks things if the top-level value isn't an object.) ~TJ

Re: Array tail destructuring

2016-10-04 Thread Tab Atkins Jr.
On Mon, Oct 3, 2016 at 8:06 PM, Caitlin Potter <caitpotte...@gmail.com> wrote: >> On Oct 3, 2016, at 10:54 PM, Tab Atkins Jr. <jackalm...@gmail.com> wrote: >>> On Sun, Oct 2, 2016 at 2:11 AM, Caitlin Potter <caitpotte...@gmail.com> >>> wrote: >>

Re: Array tail destructuring

2016-10-03 Thread Tab Atkins Jr.
On Sun, Oct 2, 2016 at 2:11 AM, Caitlin Potter wrote: > On Oct 2, 2016, at 10:50 AM, Awal Garg wrote: >> On Oct 2, 2016, at 9:30 AM, Olivier Lalonde wrote: >>> So what's the problem with `[...a, last]` that `[...a]` doesn't have? I

Re: Support () => {}() syntax?

2016-09-30 Thread Tab Atkins Jr.
On Fri, Sep 30, 2016 at 7:23 AM, Allen Wirfs-Brock wrote: > On Sep 30, 2016 6:10 AM, Kevin Smith wrote: >> Ideally there will be an `async` version of do expressions, which evaluate >> to a promise: >> >> ``` >> let promise = async do { >> await

Re: Syntax Proposal: Anonymous Arguments

2016-09-28 Thread Tab Atkins Jr.
On Fri, Sep 23, 2016 at 10:38 AM, Kenneth Powers wrote: > I have a proposal for new syntax in ES inspired by the placeholder syntax in > Scala Functions. > > Essentially, the idea would be to allow anonymous arguments. The most simple > example would be a function which takes

Re: Function constants for Identity and No-op

2016-08-10 Thread Tab Atkins Jr.
On Wed, Aug 10, 2016 at 7:25 AM, Eli Perelman wrote: > Now obviously it would be trivial for me to declare these constants in > userland code like I already do, e.g. `const NOOP = () => {}`, but in > projects where it's needed in several files, I'll have to put that in a >

Re: How to solve this basic ES6-module circular dependency problem?

2016-08-09 Thread Tab Atkins Jr.
On Tue, Aug 9, 2016 at 4:00 PM, /#!/JoePea wrote: > True, and so that's why I'm wondering if the module system can see that it > can satisfy all module requirements if it simply evaluates module C first, > followed by A or B in any order. It is easy for us humans to see that. It

Re: Operating with arbitrary timezones

2016-08-05 Thread Tab Atkins Jr.
On Fri, Aug 5, 2016 at 1:59 PM, Kris Siegel wrote: >> Once you endow them with a timezone offset they cease to represent points >> in time, but rather more points in space, which adds complexity and >> liability to any code handling Date objects > > > I would disagree. Time

Re: Why are object initializer methods not usable as constructors?

2016-07-28 Thread Tab Atkins Jr.
On Wed, Jul 27, 2016 at 11:44 AM, /#!/JoePea wrote: > What's the good reason that object-initializer methods can't be constructors > though? I mean, I get that "that's what spec says", but what's the actual > good reason? Because they're methods, not functions. The distinction

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

2016-07-25 Thread Tab Atkins Jr.
On Mon, Jul 25, 2016 at 4:28 PM, John Lenz wrote: > I understand the way it is used, but I don't understand why. "for-of" > could have been spec'd to take either an Iterable (an object with an > [Symbol.iterator] method) or an Iterator. Or just an Iterable. Not just

Re: Proposal: Bind Promise Catch to Try/Catch scope

2016-06-21 Thread Tab Atkins Jr.
On Tue, Jun 21, 2016 at 6:15 PM, Todd Hubers wrote: > 1. Whether you await or not, the try scope's catch callback [TSCC] should > still be captured. Why? Async code doesn't do anything special for try/catch anywhere else in the language - what does this proposal do

Re: Suggestion: Object.symbols

2016-06-15 Thread Tab Atkins Jr.
On Wed, Jun 15, 2016 at 3:54 PM, doodad-js Admin wrote: >> I consider all of the 'get some arbitrary subset of properties from an >> object' use cases obsoleted by `Map`. But maybe I'm missing something >> obvious or not-so-obvious...? > > Objects, obsolete with Map ? “Map” is

Re: Array.prototype.includesAll

2016-06-14 Thread Tab Atkins Jr.
On Tue, Jun 14, 2016 at 12:58 PM, Bob Myers wrote: > This proposal is so far from something that should go into the base language > that it makes me choke. > > Are you also going to propose that we add `includesNone` and `includesSome`? > Do you want to include an option to sort the

Re: New Set.prototype methods

2016-05-31 Thread Tab Atkins Jr.
On Sun, May 29, 2016 at 6:13 AM, Michał Wadas wrote: > I have written proposal for new Set.prototype methods. > > https://github.com/Ginden/set-methods > > New methods would be: > > Set.prototype.filter > Set.prototype.map > Set.prototype.some > Set.prototype.every >

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

2016-05-24 Thread Tab Atkins Jr.
On Tue, May 24, 2016 at 11:59 AM, Norbert de Langen wrote: > It would be nice to have this option: > > ``` > import { parse } as xmlLib from 'xml-lib'; > import { parse } as jsonLib from 'json-lib'; > import { parse } as htmlLib from 'html-lib'; > > // usage >

Re: Get currently destructured object

2016-05-19 Thread Tab Atkins Jr.
On Thu, May 19, 2016 at 8:59 AM, Michał Wadas wrote: > Idea: > > function foo({bar, *: baz}) { > > } > > would be equivalent to: > > function foo(baz) { >const bar = baz.bar; > } > > Rationales: > - little better IDE support (argument name reveals intention) > - allows

Re: Proposal: Switch position of delay and callback in signature of `setTimeout()`

2016-04-25 Thread Tab Atkins Jr.
On Mon, Apr 25, 2016 at 10:43 AM, Oriol Bugzilla wrote: > `setTimeout` is not part of ECMAScript. You should suggest this to WHATWG > instead. And I can short-circuit the request: we can't change it. setTimeout is an old and heavily-used API, so any change like this

Re: stable sort proposal

2016-03-18 Thread Tab Atkins Jr.
On Tue, Mar 15, 2016 at 8:50 AM, Vic9 wrote: >> What about the Timsort? > > I cannot believe it will be faster on random int array. And TimSort is base > on MergeSort and, seems, for it's worst cases it cannot be better than > MergeSort. > I have tried

Re: stable sort proposal

2016-03-18 Thread Tab Atkins Jr.
On Fri, Mar 18, 2016 at 3:57 PM, Waldemar Horwat <walde...@google.com> wrote: > On 03/18/2016 11:10, Tab Atkins Jr. wrote: >> >> If you're planning on pessimistically assuming that legacy >> implementations use an unstable sort for Array#sort(), then testing >> f

Re: stable sort proposal

2016-03-14 Thread Tab Atkins Jr.
On Fri, Mar 11, 2016 at 8:17 PM, Isiah Meadows wrote: > In my honest opinion, there's not much reason to just require the sort to be > stable. Some engines have done this in the past, and the spec technically > allows it. At this point, stable sorts are about as fast as

Re: es7 proposal/polyfill?: base Map/WeakMap off Proxy + Weak References

2016-02-19 Thread Tab Atkins Jr.
On Fri, Feb 19, 2016 at 12:59 PM, Boris Zbarsky wrote: > On 2/19/16 3:50 PM, Coroutines wrote: >> Side discussion: Why does Javascript have this limitation? - what I >> view as a limitation? You'd think this could be supported without >> breaking older JS.. > > I don't see how

Re: Any reason why __proto__ is not a well known symbol?

2016-02-15 Thread Tab Atkins Jr.
On Mon, Feb 15, 2016 at 9:14 PM, Coroutines <corouti...@gmail.com> wrote: > On Mon, Feb 15, 2016 at 8:51 PM, Tab Atkins Jr. <jackalm...@gmail.com> wrote: >> It was specified before symbols existed, and all implementations do it >> as a string property. If we were re

Re: Any reason why __proto__ is not a well known symbol?

2016-02-15 Thread Tab Atkins Jr.
On Mon, Feb 15, 2016 at 8:34 PM, JD Isaacks wrote: > I know ES2015 formally made the `__proto__` property a way to access/set an > object's internal `[[Prototype]]` property. > > Is there any reason why this wasn't spec'd as a well known symbol such as > `@@__proto__`. It just

Re: monadic extension to do-notation

2016-02-09 Thread Tab Atkins Jr.
On Sun, Feb 7, 2016 at 9:07 AM, Raphael Mu wrote: > The ES Promise is an instance of Monad, a property that implies a much more > concise and expressive syntax for using Promise, by exploiting its monadic > properties. I've seen a lot of people complain about Promises

Re: Using 'this' in default parameters

2016-02-09 Thread Tab Atkins Jr.
On Sun, Jan 31, 2016 at 3:59 PM, Bergi wrote: > Jason Orendorff wrote: >> On Fri, Jan 29, 2016 at 8:14 AM, ` Mystery . wrote: >>> IMHO I don't think the default parameters should be evaluated within the >>> context of the function being called, at least

Re: JavaScript Language feature Idea

2016-02-09 Thread Tab Atkins Jr.
On Tue, Feb 2, 2016 at 12:15 PM, Jonas Sicking wrote: > On Mon, Jan 25, 2016 at 12:38 PM, Andrea Giammarchi > wrote: >> FWIW `.at` works for me. Anything really, as long as `Symbol.last` won't >> even be proposed :D > > If we name it `.item` that

Re: Promises as Cancelation Tokens

2016-01-04 Thread Tab Atkins Jr.
On Mon, Jan 4, 2016 at 9:01 AM, Domenic Denicola wrote: > From: Kevin Smith [mailto:zenpars...@gmail.com] > >> And what's the deal, is it canceled or cancelled? : ) > > This is kind of the worst. Previous discussion at >

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

2015-12-08 Thread Tab Atkins Jr.
On Tue, Dec 8, 2015 at 9:44 AM, Andrea Giammarchi wrote: > yup, that's what my library does as well. I thought Bergi meant in absolute. I can't speak for Bergi, but yeah, I assume he was talking about a function returning a promise or not based on something other

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

2015-12-08 Thread Tab Atkins Jr.
On Sun, Dec 6, 2015 at 10:48 PM, Andrea Giammarchi wrote: > However, I'm curious to know about this "Functions that sometimes return > promises and sometimes not are already known to be an antipattern" because I > have a library that does that in somehow explicit way

Re: Map literal

2015-11-28 Thread Tab Atkins Jr.
On Thu, Oct 29, 2015 at 6:23 PM, Alexander Jones wrote: > I don't think borrowing object notation is a good idea. What exactly does > > ``` > const myMap = Map#{ > get foo() { return 100; }, > set foo(v) {} > constructor() {} > }; > ``` > > mean? > > Honestly, a very

Re: Map literal

2015-10-27 Thread Tab Atkins Jr.
On Wed, Oct 28, 2015 at 8:36 AM, Alexander Jones wrote: > I agree this is pretty important. Using actual maps really frees up a lot of > complexity, but the syntax is cumbersome to say the least. > > Whatever the decided syntax, bare words as string keys is a really bad idea > IMO.

Re: Swift style syntax

2015-10-16 Thread Tab Atkins Jr.
On Thu, Oct 15, 2015 at 11:12 PM, Isiah Meadows wrote: > I like the idea, but could the function names be made a little > shorter? I'd like to at least save some characters on it. Example: > `(a, b) => a > b` is 15 characters, where `Math.greaterThan` is 16. > > For

Re: Reflect.getDefaultParameterValues

2015-10-06 Thread Tab Atkins Jr.
On Mon, Oct 5, 2015 at 9:00 AM, Benjamin Gruenbaum wrote: > Well, I've personally thought about building a small pattern matching > library using the syntax, but that's hardly a general use case: > > ```js > match( > (x = 1) => doFoo(...) > (x = {y : 3}) => doBar(...) > ```

Re: rest parameters

2015-10-02 Thread Tab Atkins Jr.
On Fri, Oct 2, 2015 at 12:09 PM, Steve Fink wrote: > I don't know, but I can speculate. It's not at all obvious how ...args in > the middle should behave: what if you have two rest arguments? Is that > forbidden, or is one greedy? What if one of the trailing parameters has a >

Re: rest parameters

2015-10-02 Thread Tab Atkins Jr.
On Fri, Oct 2, 2015 at 3:00 PM, Michaël Rouges wrote: > For the undefined case, it isn't unexistent... > > ```JavaScript > void function () { > console.log(arguments.length); // 3 > }(1, 2, undefined); > ``` > > Then, I don't see how it may be ambiguous... Again,

Re: Alternative to Promise

2015-09-30 Thread Tab Atkins Jr.
On Tue, Sep 29, 2015 at 10:51 PM, 韩冬 wrote: > ES6 Promise is great, i just want to share my thoughts on dealing with > callback hell issue with a different approach here. > I’m been try to port ConT monad from haskell to javascript these days, after > some work, i believe

Re: Alternative to Promise

2015-09-30 Thread Tab Atkins Jr.
On Wed, Sep 30, 2015 at 5:18 PM, 韩冬 wrote: > Yes, i understand it’s too late to revise Promise design, my random thought > are: > > 1. Why we put Promise into language? Because it exposes useful functionality. I recommend reading some of the Promise explainers that exist

Re: Alternative to Promise

2015-09-30 Thread Tab Atkins Jr.
On Wed, Sep 30, 2015 at 5:46 PM, 韩冬 wrote: > Now take a look at even a very simple Promise library Q form its design > document: https://github.com/kriskowal/q/blob/v1/design/q7.js > >> The "state machine" isn't complex. "unresolved" goes to either >> "resolved to another

  1   2   3   4   5   6   >