00:00:00  * dscharrer27joined
00:03:48  * dscharrer27quit (Remote host closed the connection)
00:08:10  * CoJaBo26joined
00:12:22  * mhayden19joined
00:12:23  * CoJaBo26quit (Remote host closed the connection)
00:17:17  * mhayden19quit (Read error: Connection reset by peer)
00:21:49  * sunitknandi15joined
00:22:03  * sunitknandi15quit (Read error: Connection reset by peer)
00:31:54  * hoho`19joined
00:34:55  * hoho`19quit (Remote host closed the connection)
00:56:27  <Sirisian>ljharb, I wouldn't know who to speak with about that. Would be nice to get their input though.
01:17:59  * rkratkyjoined
01:20:34  * hw26joined
01:21:42  * rkratkyquit (Remote host closed the connection)
01:24:33  * gibson042quit (Quit: Leaving.)
01:25:03  * hw26quit (Ping timeout: 245 seconds)
01:27:13  * AtumTquit (Quit: AtumT)
01:27:39  * knaved18joined
01:35:41  * knaved18quit (Ping timeout: 252 seconds)
01:42:20  * not-an-aardvarkquit (Quit: Connection closed for inactivity)
01:47:26  * aki_joined
01:48:10  * akirosequit (Ping timeout: 272 seconds)
01:48:11  * aki_changed nick to akirose
01:50:34  * crystalclaw8joined
01:52:01  * ChrisK34joined
01:53:20  * crystalclaw8quit (Remote host closed the connection)
01:56:25  * ChrisK34quit (Remote host closed the connection)
02:49:16  * pinnerup26joined
02:54:36  * Kingsy21joined
02:56:09  * Kingsy21quit (Remote host closed the connection)
02:56:29  * pinnerup26quit (K-Lined)
03:06:56  * Kamots7joined
03:13:45  * Kamots7quit (Ping timeout: 244 seconds)
03:23:34  * jorrakay1joined
03:24:31  * jorrakay1quit (K-Lined)
03:31:03  <devsnek>no memes wtf does @@species actually exist for
03:40:35  <ljharb>devsnek: iirc it's so you can subclass something, like Array, and not have to override all the base methods, and they'll produce a `SubArray`
03:44:11  <devsnek>couldn't that just happen automatically though
03:44:23  <devsnek>`const C = this.constructor; return new C(whatever)`
03:44:36  <devsnek>like in userland thats what people do
03:45:24  <bradleymeck>devsnek: if MyArray extends Array, and I *do not* have MyArray.prototype.map defined on my class (and instead delegate to Array.prototype.map)
03:46:12  <bradleymeck>the idea was that Array.prototype.map could return new MyArray types, or in the case of utility classes it could do the opposite and forcibly return Array even though it is a subclass
03:46:32  <devsnek>Array.prototype.map could use this.constructor and utility could explicitly construct array though
03:47:03  <ljharb>devsnek: `.constructor` isn't reliable, and you couldn't ergonomically override that to be *not* your subclass if you wanted
03:47:31  <ljharb>not really defending it tho
03:47:40  <bradleymeck>i'm not saying @@species is something i understand the driving desires for
03:47:52  <devsnek>lol
03:47:53  <bradleymeck>i'm just saying what it was meant to be from my understanding
03:48:00  <devsnek>ok
03:54:30  * akirosequit (Ping timeout: 252 seconds)
03:54:53  * akirosejoined
04:40:30  * jmdyckquit (Remote host closed the connection)
04:44:21  * vikash-afkquit (Remote host closed the connection)
04:44:58  * howdoijoined
05:01:21  * vikash-afkjoined
05:16:33  * siix18joined
05:21:00  * siix18quit (Remote host closed the connection)
05:22:44  <Domenic>The desired use case was something like: 1) I want to create an X subclass, where X is Array or Promise or ... 2) I want all of its X-returning methods to return Y, where Y is not the subclass (which is the default via this.constructor lookup) but is instead something else.
05:23:01  <Domenic>Also, 3) I am not willing to override the methods themselves
05:23:23  <Domenic>This use case makes no sense, because there is never a scenario where you want to change the return type of ALL of the X-returning methods in the same way
05:24:36  <Domenic>E.g. consider a `class Elements extends Array {}`, which contains methods that operate on an array of `Element` instances. You want `filter()` to return `Elements` instances (which it would by default). But you don't want `map()` to return `Elements` instances, since `els.map(el => el.localName)` should be an `Array` of strings, not an `Elements` of strings.
05:25:18  <Domenic>But @@species is useless for this purpose. If you customize it, you can only ever make both `map()` and `filter()` return the same type, either `Elements` or `Array`. You cannot have them return types appropriate for their specific semantics.
05:25:50  <Domenic>Instead you should just override the `map()` method to return an `Array`, since that's the semantics that makes sense.
05:34:58  * ramsub08joined
05:38:31  * ramsub08quit (Read error: Connection reset by peer)
05:42:43  * IT_Sean8joined
05:44:49  * IT_Sean8quit (Remote host closed the connection)
05:58:50  * tadams12083_joined
06:00:11  * tadams12083_quit (Remote host closed the connection)
06:02:27  * akirosequit (Ping timeout: 240 seconds)
06:02:40  * akirosejoined
06:40:12  * keith_millerjoined
06:44:06  * Guest60662joined
06:45:24  * Guest60662quit (Remote host closed the connection)
06:45:57  * akoserwajoined
06:57:19  * shbstjoined
06:59:19  * brouette24joined
06:59:20  * shbstquit (Read error: Connection reset by peer)
07:00:43  * antonh_joined
07:03:20  * brouette24quit (Remote host closed the connection)
07:04:23  * antonh_quit (Killed (Sigyn (Spam is off topic on freenode.)))
07:14:38  * opv1joined
07:18:55  * opv1quit (Remote host closed the connection)
07:19:07  * Nokurn26joined
07:23:39  * Nokurn26quit (Remote host closed the connection)
07:30:28  * cottongin3joined
07:32:27  * cottongin3quit (Remote host closed the connection)
07:35:47  * DanQuinney0joined
07:38:27  * DanQuinney0quit (Remote host closed the connection)
07:45:07  * akirosequit (Quit: 👋🏻)
07:46:07  * akirosejoined
07:48:03  * charlton12joined
07:52:01  * charlton12quit (Remote host closed the connection)
08:02:31  * BigE1joined
08:07:14  * BigE1quit (Remote host closed the connection)
08:32:56  * Ox37bjoined
08:36:09  * Ox37bquit (Remote host closed the connection)
08:40:33  * windsok11joined
08:47:59  * windsok11quit (Ping timeout: 252 seconds)
09:38:59  * cspotcode2joined
09:43:16  * cspotcode2quit (Remote host closed the connection)
09:53:59  * akirosequit (Ping timeout: 252 seconds)
09:55:14  * akirosejoined
09:57:31  * atrivjoined
10:00:58  * tomeaton179joined
10:01:01  * atrivquit (Remote host closed the connection)
10:02:36  * tomeaton179quit (Read error: Connection reset by peer)
10:15:52  * Dead_Body15joined
10:18:36  * Dead_Body15quit (Remote host closed the connection)
10:40:47  * elf12joined
10:42:04  * elf12quit (Remote host closed the connection)
10:49:41  * beowulf29joined
10:52:38  * keith_millerquit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:57:16  * beowulf29quit (Read error: Connection reset by peer)
11:05:08  * lynxis18joined
11:07:33  * lynxis18quit (Remote host closed the connection)
11:11:43  * skierpagejoined
11:16:07  * CrtxReavr8joined
11:17:22  * CrtxReavr8quit (Killed (Sigyn (Spam is off topic on freenode.)))
11:17:30  * skierpagequit (Ping timeout: 252 seconds)
11:25:28  * mawe2joined
11:27:32  * Guest47903joined
11:27:42  * mawe2quit (Remote host closed the connection)
11:29:10  * Guest47903quit (Remote host closed the connection)
11:38:33  <devsnek>Domenic: that's the conclusion i came to as well
11:43:01  <ljharb>is there a use case where you want `.constructor` to be Elements, but "every method" to produce "not an Elements"?
11:57:23  * keith_millerjoined
11:59:11  * keith_millerquit (Client Quit)
12:02:32  * aki_joined
12:02:58  * akirosequit (Ping timeout: 246 seconds)
12:03:00  * aki_changed nick to akirose
12:07:35  * Liothen24joined
12:08:28  * Liothen24quit (Remote host closed the connection)
12:30:23  * jmdyckjoined
12:30:50  * RJ72218joined
12:35:21  * RJ72218quit (Read error: Connection reset by peer)
12:54:42  * Lunatrius2joined
12:56:43  * Lunatrius2quit (Killed (Sigyn (Spam is off topic on freenode.)))
13:44:47  * howdoiquit (Quit: Connection closed for inactivity)
13:51:34  * yuitimothy0joined
13:53:37  * yuitimothy0quit (Remote host closed the connection)
14:02:45  <Domenic>That's the imaginary use case where species could be useful, but there's no real world example of such a thing
14:04:22  * Mathias3joined
14:08:51  * Mathias3quit (Ping timeout: 252 seconds)
14:09:18  * aki_joined
14:10:49  * akoserwa_joined
14:11:04  * akirosequit (Ping timeout: 272 seconds)
14:11:05  * aki_changed nick to akirose
14:13:36  * akoserwaquit (Ping timeout: 260 seconds)
14:20:20  * mappum__joined
14:22:14  * Poster|n15joined
14:25:58  * mappum__quit (Remote host closed the connection)
14:27:09  * akoserwa__joined
14:27:19  * Poster|n15quit (Remote host closed the connection)
14:28:30  * jakogut29joined
14:29:02  * jakogut29quit (Remote host closed the connection)
14:29:27  * akoserwa_quit (Ping timeout: 240 seconds)
14:36:09  * akoserwa__quit (Quit: Leaving)
15:00:17  * rpamelyjoined
15:52:52  * lost_b0tjoined
15:57:18  * lost_b0tquit (Remote host closed the connection)
16:07:18  * vallor21joined
16:13:21  * vallor21quit (Remote host closed the connection)
16:16:16  * aki_joined
16:17:20  * akirosequit (Ping timeout: 252 seconds)
16:17:21  * aki_changed nick to akirose
16:58:22  * gtrs_joined
16:59:10  * gtrs_quit (Remote host closed the connection)
17:25:29  <devsnek>is there any way to detect if a constructor was called with super() vs with new/Reflect.construct
17:25:32  <TabAtkins>Domenic: That makes sense, but doesn't killing @@species entirely just mean that *all* of the methods need to be redefined on subclasses, if you want them to return something other than an Array?
17:25:54  <TabAtkins>s/something other than an Array/the subclass rather than an Array/
17:27:05  <devsnek>oh new.target !== undefined && new.target !== WhateverConstructor
17:33:42  * AtumTjoined
17:34:15  <ljharb>TabAtkins: or just the constructor property
17:34:53  <TabAtkins>ljharb: I don't understand what that means, in reference to my statement.
17:35:29  <ljharb>you can use .constructor instead of Symbol.species and it’ll work the same
17:35:57  <TabAtkins>Who is "you" in that statement?
17:36:10  <ljharb>the author of the subclass
17:36:45  <TabAtkins>How is the author of the subclass supposed to use the .constructor property to change what Array methods return?
17:41:59  * wchrestajoined
17:43:05  * wchrestaquit (Remote host closed the connection)
17:45:17  <devsnek>i think the real problem is that its pretty much never an all or nothing case
17:45:31  <Bakkot>ljharb / devsnek: you definitely cannot just use `this.constructor`, because most everything ends up having that, and we cannot make `[].slice.call(arguments)` suddenly start returning Objects instead of Arrays
17:45:58  <ljharb>ah true
17:46:10  <devsnek>change arguments to an array and this won't be a problem /s
17:46:20  <Bakkot>can't do that either :(
17:46:20  <ljharb>in general tho i don’t see why it’s reasonable to expect a foo method to return anything but a foo
17:46:43  <devsnek>agreed on that point
17:47:38  <Bakkot>ljharb: eh, factory methods being heritable makes sense to me
17:47:45  <Bakkot>it should never have been a single global name though
17:48:07  <ljharb>maybe. But then only proper subclasses should have that
17:48:50  <Bakkot>like, it makes sense to have an opt-in way to say "Array.prototype methods, when invoked on instance of this class, should use the class constructror to produce the result". and it makes sense to say "RegExp methods, when [etc]". but it makes _absolutely no sense_ to have a single flag used for _both of these things_
17:48:54  <Bakkot>no sense whatsoever
17:49:03  <TabAtkins>ljharb: Because "a foo method" doesn't look like a foo method when it's on a SubFoo; it looks like a SubFoo method.
17:49:28  <ljharb>sure, again that makes sense on a subclass
17:49:39  <Bakkot>ljharb: "proper subclasses" is not a particularly-well defined concept in a language as dynamic as JS
17:49:50  <ljharb>but if you .call on a nodelist with an array method it should only be an array
17:50:04  <ljharb>Bakkot: for builtins it means “has the right slots”
17:51:00  <TabAtkins>ljharb: I mean, I'm willing to accept that argument *if* we get equivalents to those methods that are usable on arbitrary iterables, and which return the correct iterable type. (And that are callable in a reasonably usable way, like `foo::filter(fn)` or something.)
17:51:30  <ljharb>that’s a separate thing tho. That’s not what array methods are.
17:51:35  <TabAtkins>In our current world the Array methods *are* those "usable on any iterable" functions, because... they are usable on anything.
17:51:46  <ljharb>array methods operate on arraylikes, not on iterables
17:51:57  <ljharb>Array.from being an exception.
17:52:10  <TabAtkins>Sure, .length and numeric accessors.
17:52:25  <TabAtkins>But... array-likes don't have to be Array subclasses, and sometimes *can't* be.
17:52:49  <ljharb>sure. But i don’t think it’s a reasonable expectation to get an arraylike out of an array method.
17:53:08  <ljharb>arraylike is the input. Array is the output.
17:53:23  <devsnek>you can trick them into doing that with a combo of Reflect.construct and Symbol.species anyway
17:54:15  <devsnek>i think the bigger question pops up when you're not doing weird reflective stuff
17:54:36  <TabAtkins>So you're currently reciting the *definition* of the behavior of the methods. Why do you believe that, tho? You're okay with that meaning that any Array-like has to manually implement all of the array methods, and stay updated as we add new ones?
17:55:30  <devsnek>that sounds like a task for the protocols proposal
17:55:42  <TabAtkins>devsnek: Indeed.
17:56:05  <TabAtkins>I'm fine if there's a path forward for this! Absolutely not wedded in any way to actually using the Array methods themselves; that does indeed sound hacky and weird.
17:56:09  <ljharb>yes, i think any arraylike should have to implement the methods themselves
17:56:24  <ljharb>an array subclass, tho, I’d expect shouldn’t
17:57:13  <TabAtkins>Touching on Domenic's earlier point - do you think an Array subclass's inherited `map` should return the subclass?
17:57:20  <devsnek>if you're trying to be X without actually being X you kinda invite the complexity on yourself
17:57:58  <devsnek>TabAtkins: i think it depends on what the subclass does and is
17:58:31  <TabAtkins>"it depends" isn't a usable answer to "how should we write the spec for this" ^_^
17:58:47  <devsnek>just throw a range error
17:58:49  <ljharb>yes, i think it probably should
17:59:18  <devsnek>and then if you want something else, manually overrid eit
17:59:32  <TabAtkins>The protocols proposal, last I looked, does indeed look like it would be *very* good for this. Two protocols for Array-likes, one that places no restrictions on its contents (and so can return the class from `map`, etc) and one that does (so `filter` can return the class, but `map` returns an Array in the default impl).
17:59:56  <devsnek>i don't think it can happen at the whole-thing level though
18:00:49  <TabAtkins>ljharb: Okay, so you're implying that Array subclasses must hold to the implicit guarantee that it must place no restrictions on what it can hold. And anything that *does* want to place such restrictions (such as Elements) must instead be an array-like that reimplements everything manually?
18:01:19  <TabAtkins>(I'm not playing gotcha, btw, just drawing out the actual positions of other people in the group.)
18:02:48  <devsnek>any object value makes that guarantee anyway
18:02:53  <devsnek>unless you use proxies or something
18:03:39  <TabAtkins>Ignoring the possibility of people monkeying around in the guts, sure.
18:04:02  <Domenic>Bakkot: devsnek: ljharb: the general pattern of @@species vs. this.constructor is separate from the web-compat hacks necessary for Array in particular.
18:04:13  <devsnek>if you want to limit what the SubArray holds (assuming people only use push/unshift/etc) then yeah i would expect you to manually have to override all those
18:04:35  <TabAtkins>A WebIDL Elements object would maintain its internal state in a private symbol, and use a getter/setter to access that symbol; manual monkeying aroudn would just set properties on the object, not on the internal state.
18:09:33  * jeremy_carroll16joined
18:09:52  * jeremy_carroll16quit (Remote host closed the connection)
18:18:37  * AtumT_joined
18:21:27  * AtumTquit (Ping timeout: 240 seconds)
18:22:15  * aki_joined
18:23:04  * akirosequit (Ping timeout: 246 seconds)
18:23:04  * aki_changed nick to akirose
18:32:22  * AtumTjoined
18:33:16  * AtumT_quit (Ping timeout: 272 seconds)
18:35:30  <Bakkot>Domenic: yes and no. there are cross-realm web compat reasons that ArraySpeciesCreate in particular is weird, but there are also seperate web compat reasons reasons why `this.constructor` could not be used for the thing Symbol.species does, at least not on array methods
18:38:21  <Bakkot>(anyway I think I agree with you, Symbol.species delenda est)
18:41:26  * hexingb19joined
18:43:29  * hexingb19quit (Killed (Sigyn (Spam is off topic on freenode.)))
18:45:01  * abi`14joined
18:47:27  * abi`14quit (Remote host closed the connection)
19:10:45  * Aldem20joined
19:16:41  * Aldem20quit (Remote host closed the connection)
20:14:18  * jasonaowen23joined
20:18:41  * jasonaowen23quit (Remote host closed the connection)
20:28:21  * aki_joined
20:29:16  * akirosequit (Ping timeout: 260 seconds)
20:29:16  * aki_changed nick to akirose
21:00:22  * alpha_shjoined
21:00:55  * Guest52342joined
21:01:56  * Guest52342quit (Remote host closed the connection)
21:06:47  * alpha_shquit (Remote host closed the connection)
21:35:12  * cloudshujoined
22:34:33  * aki_joined
22:35:03  * akirosequit (Ping timeout: 245 seconds)
22:35:03  * aki_changed nick to akirose
23:24:53  * rpamelyquit (Quit: Connection closed for inactivity)
23:35:38  * Acou_Bass9joined
23:42:24  * Acou_Bass9quit (Remote host closed the connection)
23:44:37  * keith_millerjoined