02:11:05  * keith_millerquit (Quit: My MacBook has gone to sleep. ZZZzzz…)
02:50:20  * keith_millerjoined
03:53:19  * keith_millerquit (Quit: My MacBook has gone to sleep. ZZZzzz…)
04:06:11  * keith_millerjoined
04:14:43  * jmdyckquit (Remote host closed the connection)
06:34:42  * keith_millerquit (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:24:58  * IgnoredAmbiencequit (Ping timeout: 264 seconds)
09:21:15  * IgnoredAmbiencejoined
09:56:05  * IgnoredAmbiencequit (Ping timeout: 240 seconds)
10:25:06  * mylesborinsquit (Quit: farewell for now)
10:25:36  * mylesborinsjoined
11:27:10  * jmdyckjoined
12:41:16  * IgnoredAmbiencejoined
15:10:55  * AtumTjoined
20:54:06  * keith_millerjoined
20:54:35  * IgnoredAmbiencequit (Ping timeout: 240 seconds)
21:39:50  * IgnoredAmbiencejoined
22:56:32  <devsnek>i added onto my reflect type methods a bit, now with Reflect.is which is what i would consider a proper replacement for instanceof: https://gist.github.com/devsnek/a99cd87a85644224255ef111ef3afebb
22:57:04  <devsnek>i'm undecided if Reflect.is should walk up the prototype though
22:57:55  <devsnek>like if the match is false check higher up the prototype chain
23:00:58  <devsnek>making this real would assume that these symbols would be shared across realms
23:04:35  * arai_quit (Ping timeout: 246 seconds)
23:29:22  <ljharb>devsnek: it wouldn't do any good tho to just return a string, `type` has to be a (brand-checking) function that returns a string
23:29:32  <devsnek>thats what Reflect.is is for
23:29:39  <devsnek>Reflect.typeOf is just prettyness
23:30:04  <devsnek>well not prettyness
23:30:14  <ljharb>your impl there of Reflect.is just compares symbol property values
23:30:19  <devsnek>right
23:30:24  <ljharb>so that's not sufficient
23:30:34  <ljharb>the thing that's stored on each builtin's prototype has to be a brand-checking function
23:30:40  <ljharb>otherwise it's no better than Symbol.toStringTag
23:31:09  <devsnek>howso
23:31:19  <ljharb>iow i have to be able to do `const mapType = Map.prototype[MagicSymbol]; … mapType.call(maybeMap)` to determine if it's a Map
23:31:34  <ljharb>the problem with toStringTag is that anything can pretend to be anything else
23:31:49  <devsnek>the symbols should be internal properties
23:31:51  <ljharb>your gist up there doesn't address that at all; it's the same exact feature
23:31:58  <ljharb>symbols are all public, i'm not sure what that means
23:32:12  <devsnek>like Object.[[Identity]]
23:32:16  <devsnek>not a symbol on object
23:32:25  <devsnek>i just can't do that with javascript for the example
23:32:27  <ljharb>ok, so it's an internal slot
23:32:47  <ljharb>then the next question arises - how can an object not provided by the engine participate in this system?
23:33:06  <devsnek>Symbol.type maybe
23:33:17  <ljharb>(i can skip a lot of the leading questions and point out that jasnell's proposal is exactly what's needed already)
23:33:30  <ljharb>sure. but then if it's a symbol, it would seem reasonable for the builtins to have that too
23:33:42  <ljharb>since it's valuable and useful for engines to be able to implement everything in pure JS
23:33:46  <devsnek>whats the optimal thing to do here
23:34:01  <ljharb>imo jasnell's proposal verbatim, modulo naming bikesheds.
23:35:20  <ljharb>something that a) any JS object can participate in, that b) any object can pretend to be any other object, but c) it's possible for first-run code to prevent "b" within its own scope
23:35:21  <devsnek>so a method somehow mounted to things
23:35:24  <devsnek>which returns true or false
23:35:34  <ljharb>or a string
23:35:56  <ljharb>like literally "Symbol.toStringTag but the values are brand-checking functions that return strings or throw, instead of just being strings"
23:36:09  <ljharb>(or instead of throwing, return false or something)
23:36:47  <devsnek>looking at jasnell's proposal its not immediately clear how doing a function instead of a value changes anything
23:37:20  <ljharb>because if it's a function, i can save a reference to it earlier, and then nobody can replace or delete that value later
23:37:43  <ljharb>ie `const mapType = Map.prototype[magicSymbol]` and then much later, i can safely do `mapType.call(maybeMap) === 'Map'`
23:37:57  <ljharb>and it won't matter if `maybeMap` has tried to fake being a Map - or tried to fake *not* being one.
23:38:00  <devsnek>with mine that `mapType` is just `Reflect.is(?, Map)`
23:38:10  <ljharb>right but how does that work when `Map` can come from any realm
23:38:39  <ljharb>and if the answer is "internal slots", then self-hosted JS can't do it
23:38:46  <ljharb>and if the answer is "anything on Map" then anyone can fake it
23:39:27  <ljharb>the only safe thing is an extractable function, somewhere. with your example it'd have to be on *both* `Map` and also on `?`
23:39:44  <ljharb>(with jasnell's it only has to be on `?`)
23:39:49  <devsnek>right
23:40:49  <devsnek>so why did jasnell's proposal get stopped again
23:40:57  <devsnek>after this talk it does seem to be pretty perfect
23:46:59  <devsnek>ljharb: once inside the builtin function any magic can happen like internal slots and such to verify a type right?
23:51:43  <devsnek>so this in theory should be enough: https://gist.github.com/devsnek/a99cd87a85644224255ef111ef3afebb#file-symbol-checktype-js