Re: Destructuring by

2021-03-03 Thread #!/JoePea
Or maybe it would be ```js theFunction(obj., obj.); ``` to explicitly pass the particular properties, and would account for nested properties too: ```js theFunction(obj.foo., obj.lorem.); ``` #!/JoePea On Wed, Mar 3, 2021 at 6:29 PM #!/JoePea wrote: > > I think it is a good idea, but

Re: Destructuring by

2021-03-03 Thread #!/JoePea
allow the function to destructure, and only destructure, by reference of those given properties, for example. Then the contract can not silently change from secure to insecure. #!/JoePea On Wed, Mar 3, 2021 at 9:47 AM Andrea Giammarchi wrote: > > to expand further: you *could*

Re: Why does Object.keys return an Array instead of a Set?

2020-10-26 Thread #!/JoePea
lar) would surely create a single object. #!/JoePea On Sun, Oct 18, 2020 at 10:19 AM Jordan Harband wrote: > > `new Set(Object.keys(obj))` seems pretty straightforward - I doubt it's worth > adding something to the language just to make that shorter. > > Separately, if you're looking

Re: Are ES6 modules in browsers going to get loaded level-by-level?

2020-10-22 Thread #!/JoePea
re closed source. Seems that even http://jspm.dev is closed source. Looks like at this point in time people are aiming to make money from ESM servers, and there's no viable open source ESM server solution. #!/JoePea On Sun, Oct 18, 2020 at 8:50 AM Randy Buchholz wrote: > > Right, it's basic

Re: Proposal: Function.prototype.bindContext

2020-10-17 Thread #!/JoePea
I think it's a good idea that would make things more efficient. +1 *#!/*JoePea On Thu, Sep 17, 2020 at 12:57 PM Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > I'm not sure I'm following, but I'm not here to find solutions, I already > have solutions, I'm here to p

Re: Are ES6 modules in browsers going to get loaded level-by-level?

2020-10-17 Thread #!/JoePea
een lodade by its identifier, can we? So we have to make the request, because that's the only way to check. #!/JoePea On Sat, Oct 17, 2020 at 1:28 PM Randy Buchholz wrote: > > I think some form of bundling will always be necessary. I use classes and > took a name-spaced and typed

Re: Since JSDoc seems cerebrally dead...

2020-10-17 Thread #!/JoePea
That would be interesting indeed. Encouraging documentation is great I think. #!/JoePea On Sat, Oct 17, 2020 at 3:38 AM Michaël Rouges wrote: > > Yeah, I prefer the JSDoc solution too for the same reasons... but JSDoc is > really slow to evolve, > always several years behind the sta

Re: Why does Object.keys return an Array instead of a Set?

2020-10-17 Thread #!/JoePea
Well that makes sense! Would it be worth adding an option like `Object.keys(obj, true)` to return a set? Or perhaps `Object.keySet(obj)`? #!/JoePea On Fri, Oct 16, 2020 at 11:54 PM Jordan Harband wrote: > > Because Object.keys was standardized in 2009, 6 years before Set existed. > >

Re: Are ES6 modules in browsers going to get loaded level-by-level?

2020-10-16 Thread #!/JoePea
es-dev-server by open-wc seems to be import-aware. https://open-wc.org/developing/es-dev-server.html #!/JoePea On Fri, Oct 16, 2020 at 6:40 PM #!/JoePea wrote: > > So in practice, bundling is still a thing because there isn't an > import-aware server that has been released th

Why does Object.keys return an Array instead of a Set?

2020-10-16 Thread #!/JoePea
Sets are faster, even for tiny lists of four items. See the perf tests (tested in Chrome): https://twitter.com/trusktr/status/1315848017535098880 https://twitter.com/trusktr/status/1317281652540731392 #!/JoePea ___ es-discuss mailing list es-discuss

Re: Are ES6 modules in browsers going to get loaded level-by-level?

2020-10-16 Thread #!/JoePea
So in practice, bundling is still a thing because there isn't an import-aware server that has been released that proves to be better than bundling? Or perhaps it's too much overhead to set up a server, so people just bundle? #!/JoePea On Wed, Oct 14, 2020 at 2:45 PM Randy Buchholz wrote

Re: Since JSDoc seems cerebrally dead...

2020-10-16 Thread #!/JoePea
also without build tools). However, JSDoc can not currently do everything that regular TypeScript syntax can do (there's some open issues regarding that in the TypeScript repo). #!/JoePea On Wed, Oct 14, 2020 at 11:53 AM kai zhu wrote: > > > Sorry but my question isn't about providi

Re: Why does a JavaScript class getter for a private field fail using a Proxy?

2020-10-12 Thread #!/JoePea
I introduce a single private field within my class. #!/JoePea On Mon, Jul 27, 2020 at 3:33 PM Jordan Harband wrote: > > oh oops, i meant `if (o !== this)` not `if (o.foo !== this)` :-) > > On Mon, Jul 27, 2020 at 3:06 PM #!/JoePea wrote: >> >> > `o.foo(); // works

Re: Private fields in sub-objects within class definition.

2020-10-12 Thread #!/JoePea
being in play would be neat too! #!/JoePea On Sun, Aug 9, 2020 at 7:55 PM Michael Theriot wrote: > > Why stop at class definitions? > > e.g. > ```js > let obj; > { > let local = 0; > obj = { > get local() { > return local; > } > } &g

Re: Since JSDoc seems cerebrally dead...

2020-10-12 Thread #!/JoePea
Why not? People are generating less docs now? That doesn't sound good! #!/JoePea On Mon, Aug 17, 2020 at 4:15 PM Isiah Meadows wrote: > > JSDoc is not dead (far from it), people just don't frequently use > automated docs generation tooling in the JS community. Most the actual &g

Re: Re: Are ES6 modules in browsers going to get loaded level-by-level?

2020-10-12 Thread #!/JoePea
Right, exactly. So naively sending all dependencies wastefully is just the first step. > Afaik the more promising path are prefetch hints on the client. E.g. the client (or initial HTML payload) knows the dependency tree, adds tags for preloading the required modules, and then the browser can

Re: Re: Are ES6 modules in browsers going to get loaded level-by-level?

2020-10-12 Thread #!/JoePea
I'm asking about a server that, upon request of a `.js` file, knows how to enumerate the dependency tree based on that file, _then_ HTTP pushes all the modules at once. So basically, from the code ```html

nested import statements

2020-10-12 Thread #!/JoePea
-analyzable) imports should appear only within `async` functions (so they operate the same as `await import()`). Is there something bad about the idea that isn't described in those writings? #!/JoePea ___ es-discuss mailing list es-discuss@mozilla.org https

Re: Re: Are ES6 modules in browsers going to get loaded level-by-level?

2020-10-10 Thread #!/JoePea
be attractive to those people who normally publish static sites and need to publish ES Modules as static resources somewhere without the fuss if managing a server. #!/JoePea ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es

Re: A Function.tag proposal?

2020-09-24 Thread #!/JoePea
of pasting my identity tag everywhere. #!/JoePea On Thu, Sep 24, 2020 at 2:25 PM #!/JoePea wrote: > > I mean, it would be only a parse time cost if the identity tag is used like > > ```js > String.tag`...anything...` > ``` > > assuming it is not monkey-patchab

Re: A Function.tag proposal?

2020-09-24 Thread #!/JoePea
I mean, it would be only a parse time cost if the identity tag is used like ```js String.tag`...anything...` ``` assuming it is not monkey-patchable (readonly). But maybe if it is patchable then all bets are off, and it has a runtime cost. #!/JoePea On Thu, Sep 24, 2020 at 2:22 PM #!/JoePea

Re: A Function.tag proposal?

2020-09-24 Thread #!/JoePea
Perhaps a built-in identity tag would be only a parse-time performance cost. #!/JoePea On Thu, Sep 24, 2020 at 2:21 PM #!/JoePea wrote: > > I don't know what you mean about the raw stuff, but using `/*css*/` > works perfectly fine in VS Code with a plugin. There's no reason > intell

Re: A Function.tag proposal?

2020-09-24 Thread #!/JoePea
right. Missing auto-completion inside the little comment isn't that bad. I prefer using the comment because using an identity tag just for syntax feels like I'm adding a performance cost for no reason related to my runtime code. But perhaps a built-in identity tag would be fast. #!/JoePea On Mon

Private fields in sub-objects within class definition.

2020-08-07 Thread #!/JoePea
ies with WeakMap-ish semantics. #!/JoePea ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Why does a JavaScript class getter for a private field fail using a Proxy?

2020-07-27 Thread #!/JoePea
> `o.foo(); // works` I think there is something missing from that example as that line throws before it can get to the `new Proxy` line. #!/JoePea On Wed, Jul 15, 2020 at 10:47 PM Jordan Harband wrote: > > So can: > ```jsx > const o = { foo() { if (o.foo !== this) {

Re: Why aren't interpolation values in tagged template calls saved as a cached array?

2020-07-27 Thread #!/JoePea
nce in some way? #!/JoePea On Sun, Jul 26, 2020 at 11:33 AM Andrea Giammarchi wrote: > > there is some fundamental misconception of the ECMAScript standard in these > examples ... to start with, assuming the same `arguments` object is passed > twice to two different invokes of a callba

Re: Why aren't interpolation values in tagged template calls saved as a cached array?

2020-07-26 Thread #!/JoePea
(argsArrays[0] === argsArrays[1]) // false! ``` So yeah, just wondering why our only option is to use `...args` and create new arrays each time, thus the performance is not optimized like it is with the string parts. #!/JoePea On Sun, Jul 26, 2020 at 10:49 AM #!/JoePea wrote: > > What

Why aren't interpolation values in tagged template calls saved as a cached array?

2020-07-26 Thread #!/JoePea
ike it would've been great to have the cached values arrays too. Why isn't this the case? #!/JoePea ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Why can't the left-hand side of an assignment expression use optional chaining?

2020-07-14 Thread #!/JoePea
There's a good number of upvotes for it. It would be nice. #!/JoePea On Thu, Apr 30, 2020 at 1:13 PM Jordan Harband wrote: > > See https://github.com/tc39/proposal-optional-chaining/issues/18 > > On Thu, Apr 30, 2020 at 1:08 PM #!/JoePea wrote: >> >> I was hop

Re: Are ES Modules garbage collected? If so, do they re-execute on next import?

2020-07-14 Thread #!/JoePea
that only ever allocates memory that will never be freed. Is someone working on a solution for this? #!/JoePea On Wed, Jul 1, 2020 at 6:16 AM Mark S. Miller wrote: > > No, definitely not. The table from specifiers to module instances is indexed > by specifiers. Specifiers are st

Re: Any way to detect an async stack trace (like Chrome devtools does)?

2020-07-14 Thread #!/JoePea
licate frames in the stack, so a loop would result in only one unique set of entries in the stack trace and not repeat. #!/JoePea On Sun, Jul 12, 2020 at 11:53 AM Jacob Bloom wrote: > > Reading through the issue JoePea linked to, it looks like the difficulties > with standardized asy

Re: Why does a JavaScript class getter for a private field fail using a Proxy?

2020-07-14 Thread #!/JoePea
> private members (safely) allow classes with internal slots. I'd say that they aren't safe, if they can break 3rd-party code on the external public side. #!/JoePea On Sun, Jul 12, 2020 at 3:09 PM Michael Theriot wrote: > > I assume OP wants to use proxies and private members

Re: Why does a JavaScript class getter for a private field fail using a Proxy?

2020-07-14 Thread #!/JoePea
then give it to external code, or if you tell all your users to make sure they write proxy membranes for all your methods (ouch!). A true solution would leave all existing code working as-is, and would never break if internal code introduced a private field. #!/JoePea On Sun, Jul 12, 2020 at 3:17 P

Re: Any way to detect an async stack trace (like Chrome devtools does)?

2020-07-10 Thread #!/JoePea
Error at globalThis.fetch (pen.js:5) at three (pen.js:27) ``` Live example: https://codepen.io/trusktr/pen/b8fd92752b4671268f516ad3804869e4?editors=1010 I opened a request for this over here: https://github.com/tc39/proposal-error-stacks/issues/34 #!/JoePea On Fri, Jul 10, 2020 at 1:21

Re: Any way to detect an async stack trace (like Chrome devtools does)?

2020-07-10 Thread #!/JoePea
to detect traces in third-party code installed locally). #!/JoePea On Wed, Jul 8, 2020, 2:13 AM kai zhu wrote: > here's a simple throwaway-function you can wrap around promises like fetch > to get the caller's async-stack-trace `promiseWithErrorStack`: > > ```html > > > &g

Any way to detect an async stack trace (like Chrome devtools does)?

2020-07-07 Thread #!/JoePea
. As a specific example, I'd like to detect the async stack trace of any call to `fetch`. Is such a thing possible with runtime code? Or would it require instrumentation of the source code? #!/JoePea ___ es-discuss mailing list es-discuss@mozilla.org https

Are ES Modules garbage collected? If so, do they re-execute on next import?

2020-06-30 Thread #!/JoePea
(because farming for resources is disabled if the app is not running, or something). I would imagine that we want unused modules (when we leave a planet, for example) to be (destroyed) garbage collected so that we don't waste memory. #!/JoePea ___ es

A way to construct Functions with custom scopes?

2020-06-10 Thread #!/JoePea
steps to have a clean way of doing it. #!/JoePea ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Why can't the left-hand side of an assignment expression use optional chaining?

2020-04-30 Thread #!/JoePea
I was hoping to avoid things like ```js const baz = this.foo?.bar?.baz if (baz) baz.lorem = 123 ``` #!/JoePea On Thu, Apr 30, 2020 at 1:04 PM #!/JoePea wrote: > > This is perfectly fine: > > ```js > this.foo?.bar?.setBaz(123) > ``` > > but this is not: > > ``

Why can't the left-hand side of an assignment expression use optional chaining?

2020-04-30 Thread #!/JoePea
and awesomely inserts the `?` characters, only to fail once I write the assignment part. #!/JoePea ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-11-22 Thread #!/JoePea
being equivalent to "window". (I know it is wrong, but that's what many people think while not knowing about window proxies). On Thu, Nov 21, 2019 at 2:37 PM Boris Zbarsky wrote: > On 11/21/19 5:21 PM, #!/JoePea wrote: > >> They were duly marked invalid, because the problem was wit

Re: Re: Proxy handler.has() does not have a receiver argument?

2019-11-22 Thread #!/JoePea
I forgot to add, this even works with builtin scenarios like Custom Elements, ```js class MyEl extends mix(HTMLButtonElement, One, Two, Three) { /* ... */ } customElements.define('my-el', MyEl) ``` On Fri, Nov 22, 2019 at 9:36 AM #!/JoePea wrote: > HI Cyril, thanks for pointing that out

Re: Re: Proxy handler.has() does not have a receiver argument?

2019-11-22 Thread #!/JoePea
g.ts#L10 > > On Fri, Nov 22, 2019 at 4:23 AM #!/JoePea wrote: > >> After messing with Proxy-on-prototypes for two days, I've just come to >> the conclusion that I probably need to have Proxies on this (the >> receiver) returned from constructors to achieve what I want. A

Re: Re: Proxy handler.has() does not have a receiver argument?

2019-11-21 Thread #!/JoePea
inheritance-related traps. That might make some things easier. On Thu, Nov 21, 2019 at 2:55 PM #!/JoePea wrote: > > I really thing that because `has` is about detecting inherited > properties, the `receiver` parameter should be included. For things > like `ownKeys`, which are not about

Re: Proxy Reflect.has() call causes infinite recursion? (#!/JoePea)

2019-11-21 Thread #!/JoePea
Any idea why it isn't spamming the console? I mean, if it is recursive, shouldn't it fire my console.logs over and over, like 50,000 times, before finally throwing the error? On Thu, Nov 21, 2019 at 3:12 PM Alex Vincent wrote: > > I'm afraid your testcase is still far too complicated to really

Re: Re: Proxy handler.has() does not have a receiver argument?

2019-11-21 Thread #!/JoePea
I really thing that because `has` is about detecting inherited properties, the `receiver` parameter should be included. For things like `ownKeys`, which are not about inheritance, then yeah, let's not add receiver there. I'm trying to implement my own multiple inheritance, but now I stumbled on

Re: Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-11-21 Thread #!/JoePea
I should stop asking questions about something that is highly-unlikely to change! I can live with it. :) Thanks anyways for the insights. - Joe On Thu, Nov 21, 2019 at 2:21 PM #!/JoePea wrote: > > > They were duly marked invalid, because the problem was with the > &g

Re: Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-11-21 Thread #!/JoePea
ty didn't match what was intuitive. I'd say it is a DX flaw. Honestly though, I don't know what a fix would be. I'm not sure I even know what "globalThis" means now. :) On Sun, Nov 17, 2019 at 11:52 AM Boris Zbarsky wrote: > > On 11/16/19 12:52 PM, #!/JoePea wrote: > > Th

Re: Proxy Reflect.has() call causes infinite recursion?

2019-11-21 Thread #!/JoePea
Sorry you all, I realized I should've simplified it. Here's a [simpler fiddle](https://jsfiddle.net/trusktr/tf6hdn48/6/). On Thu, Nov 21, 2019 at 1:17 PM #!/JoePea wrote: > > I was trying to implement "multiple inheritance" in the following code > ([jsfiddle](https://j

Proxy Reflect.has() call causes infinite recursion?

2019-11-21 Thread #!/JoePea
I was trying to implement "multiple inheritance" in the following code ([jsfiddle](https://jsfiddle.net/trusktr/tf6hdn48/)), but it gives a max call stack (infinite recursion) error. However, the infinite recursion does not execute any of my console.log statements repeatedly like I'd expect, so

Re: Custom Elements in Templates

2019-11-16 Thread #!/JoePea
This is indeed an ugly problem that I've faced when making Custom Elements. The problem is: in templates, custom elements do not get "upgraded" into their identity. They only get "upgraded" once they are inserted into the live DOM. The best you can do is make deferred code in your custom element

Re: Conditional await, anyone?

2019-11-16 Thread #!/JoePea
I haven't read the whole thread, but I also disliked the ugly conditional checking I had to do to get faster results. I agree that this would changed perceived code execution order (unexpectedly, a breaking change). I believe that a better solution would be to make it explicit in the function

Re: Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-11-16 Thread #!/JoePea
who know enough not to be confused, or the very few people hitting a browser bug that should in all honesty be patched in effort to make things easy for end developers. All the best, - Joe On Mon, Oct 7, 2019 at 1:11 PM Boris Zbarsky wrote: > > On 10/7/19 1:56 PM, #!/JoePea wrote: > &

Re: [proposal-idea] Variable decorators

2019-11-16 Thread #!/JoePea
Any one have any thoughts on this? On Fri, Oct 4, 2019 at 11:54 AM #!/JoePea wrote: > > Currently we can implement things like "reactive variables" and > "reactive computations". Contrived example: > > ```js > import {rv, computation} from './rea

Re: Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-10-07 Thread #!/JoePea
Fri, Oct 4, 2019 at 12:33 PM Boris Zbarsky wrote: > > On 10/4/19 2:39 PM, #!/JoePea wrote: > >> but the global `this` you captured still has the same identity as the new > >> reference. > > > > Interesting, I never knew that. Do you have a code sample to

Re: Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-10-07 Thread #!/JoePea
I didn't see it. For some reason my gmail thread split into two separate threads, and I read one before the other. On Mon, Oct 7, 2019 at 7:14 AM Boris Zbarsky wrote: > > On 10/7/19 1:29 AM, #!/JoePea wrote: > > I've never written any sort of code that can prove or verify any of >

Re: Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-10-06 Thread #!/JoePea
Ah, this thread got forked from the other one, which has a code sample. Taking a look at that... On Sun, Oct 6, 2019 at 10:29 PM #!/JoePea wrote: > > I never knew any of all that stuff you have all mentioned, and as an > end user, I don't think I would ever need to know. To me, I use

Re: Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-10-06 Thread #!/JoePea
I never knew any of all that stuff you have all mentioned, and as an end user, I don't think I would ever need to know. To me, I use `window` as a global object, and it has never been more than that. I've never written any sort of code that can prove or verify any of what you all are talking

[proposal-idea] Variable decorators

2019-10-04 Thread #!/JoePea
Currently we can implement things like "reactive variables" and "reactive computations". Contrived example: ```js import {rv, computation} from './reactive-variable' const count = rv(0) // read the value console.log(count()) // 0 // set the value count(1) console.log(count()) // 1 //

Re: Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-10-04 Thread #!/JoePea
s misuse "entries" as if it were synonymous with "pairs". > Contrast this with Underscore's `_.pairs`, named by a native English speaker > back in 2012, long before ES6 was a thing, and it stood as precedent for > having `coll.entries()` for various collections. > &

Why globalThis instead of something intuitive like globalObject, systemGlobal, or globalEntity?

2019-09-21 Thread #!/JoePea
I know it may be too late for this, but I imagine `globalThis` can bring confusion to beginners, especially ESL beginners. Things like `globalObject`, `systemGlobal`, or `globalEntity` would've been more intuitive; they make sense in plain English. Well anyways, have a good weekend! - Joe

Promise resolution handler fires before synchronous constructor stack has finished.

2019-07-27 Thread #!/JoePea
I feel like I'm going crazy, but I have a class hierarchy, and one of the constructors in the hierarchy defers some logic to a microtask, ```js // class Foo constructor() { Promise.resolve().then(() => { this.methodThatSubclassOverrides() }) } methodThatSubclassOverrides() {} ``` and in

Re: Re: Actual WeakSet Use Cases

2019-04-22 Thread #!/JoePea
(I edited the broken format of my previous post) What other use cases are there? On Mon, Apr 22, 2019 at 11:20 AM #!/JoePea wrote: > > WeakSets are perfect for branding and are how I would expect web > platform class branding to be explained. > > > > ```js > &g

Re: Re: Actual WeakSet Use Cases

2019-04-22 Thread #!/JoePea
> WeakSets are perfect for branding and are how I would expect web platform class branding to be explained. > > ```js > const foos = new WeakSet(); > > class Foo { > constructor() { > foos.add(this); > } > > method() { > if (!foos.has(this)) { > throw new

A way to fire logic at the end of completion of the current class method (regardless of super call order).

2019-02-07 Thread #!/JoePea
I many times find myself in cases where a base class wants to ensure that logic is always fired after the current method's execution, so that for example no matter in which order sub classes call the `super` method, the `super` method can still guarantee that logic fires after the whole stack of

idea: Array.prototype.remove

2019-02-03 Thread #!/JoePea
I sometimes find myself doing things like ```js this.children.splice(this.children.indexOf(child), 1) ``` but it seems that it will iterate the array twice. Maybe a new method can be introduced so engines can optimize it: ```js this.children.remove(child) // or

returning non-Promise values from async functions and running them synchronously (or Promise.sync() idea)

2019-02-03 Thread #!/JoePea
I often find myself enjoying async functions until the time comes when I don't want to await anything, and I want the call stack to be sync (i.e. I don't want to defer if I don't have to). But, async functions always return a Promise. So I find my self converting my async functions back into

How to prettify output of objects in the console, when using get/set, like browsers do?

2019-01-09 Thread #!/JoePea
Here's some nice output in the console in Chrome, for `DOMPoint` and `DOMPointReadOnly` classes: ```js const point = new DOMPoint(1,2,3,4) console.log(point) ``` output: ``` > DOMPoint {x: 1, y: 2, z: 3, w: 4} ``` ([codepen example](https://codepen.io/anon/pen/xmaVej), open the devtools

Re: Polyfilling Object.observe

2018-07-28 Thread #!/JoePea
crickets ``` `Object.observe` just works, and is s simple. I won't shoot myself in the foot with it. I'd like to make a one-way data flow implementation with it, using 3rd party web components, and `Object.observe` would make this _incredibly simple_. */#!/*JoePea On Sat, Jul 28, 2018 a

Re: Polyfilling Object.observe

2018-07-27 Thread /#!/JoePea
z'], (propName, newValue) => { console.log('changed value:', propName, newValue) }) o.foo = 'foo' o.bar = 'bar' o.baz = 'baz' ``` */#!/*JoePea ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Polyfilling Object.observe

2018-07-27 Thread /#!/JoePea
Another caveat of my implementation, for example, is that it adds getters/setters for properties that previously didn't exist. This will break code that checks existence of props. etc. etc. That's not a problem with a theoretical `Object.observe`. */#!/*JoePea On Fri, Jul 27, 2018 at 10:53 AM

Re: Polyfilling Object.observe

2018-07-24 Thread /#!/JoePea
props are not. If I am okay to drop support for IE (I'm a little skeptical), then I'd like to consider how Proxy might help, but it just seems more complicated that it ought to be compared to `Object.observe` (which my behaviors could use to observe elements). */#!/*JoePea On Tue, Jul 24, 2018

Polyfilling Object.observe

2018-07-24 Thread /#!/JoePea
Is there a way to polyfill `Object.observe` in such a way that the object before observation is the same reference as the object being observed after the call (i.e. not a Proxy), and other than monkey-patching getters/setters? Is defining getters/setters the only way? */#!/*JoePea

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2018-04-16 Thread /#!/JoePea
modules (just needs infrastructure for passing that info around). On Sun, Apr 15, 2018, 11:58 AM Mike Samuel <mikesam...@gmail.com> wrote: > The box function defined in github.com/mikesamuel/tc39-module-keys > enables things like this. > > > On Sun, Apr 23, 2017 at 4:42 PM, /#!/JoePea <

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2018-04-15 Thread /#!/JoePea
Ah, interesting! That would be useful! */#!/*JoePea On Sun, Apr 15, 2018 at 11:58 AM, Mike Samuel <mikesam...@gmail.com> wrote: > The box function defined in github.com/mikesamuel/tc39-module-keys > enables things like this. > > > On Sun, Apr 23, 2017 at 4:42 PM, /#!/Jo

Re: Share a secret across ES6 specific modules, so that other modules cannot access the secret?

2018-04-15 Thread /#!/JoePea
Thanks for sharing that Claude. It's interesting to see how others are implementing public/protected/private for their classes. :) - Joe */#!/*JoePea On Mon, Apr 24, 2017 at 12:34 PM, Bradley Meck <bradley.m...@gmail.com> wrote: > To an extent, yes. You can use hoisting of function decla

Re: extending an ES6 class using ES5 syntax?

2018-04-02 Thread /#!/JoePea
Ah, makes sense. Thanks! - Joe */#!/*JoePea On Thu, Mar 29, 2018 at 9:53 PM, Rob Brackett <r...@robbrackett.com> wrote: > Why is it that the static version you implemented above can `.apply` > itself without this same error (and `new` is not being used)? > > > Wow, this

How many ES5 environments are still in use today?

2018-04-02 Thread /#!/JoePea
. Do you know of some place to get such statistics besides for browsers? */#!/*JoePea ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Re: extending an ES6 class using ES5 syntax?

2018-03-28 Thread /#!/JoePea
, if I try the following, it fails: ```js class Foo {} Foo.apply(window, ['foo']) ``` Why is it that the static version you implemented above can `.apply` itself without this same error (and `new` is not being used)? - Joe */#!/*JoePea ___ es-discuss maili

Re: Object.unfreeze, or similar API

2018-03-24 Thread /#!/JoePea
. If the engine were to read these all in advance, this would cause a problem. Are we sure that all engines don't read the handler spec in advance? */#!/*JoePea On Sat, Mar 24, 2018 at 2:59 PM, Oriol _ <oriol-bugzi...@hotmail.com> wrote: > Hi Joe, I used a 2nd proxy as the handler in order to o

Something like Object.freeze, but not inherited from prototypes.

2018-03-24 Thread /#!/JoePea
instances of my classes can be modified, but all prototypes in the inheritance are not. I'm also noting that Object.seal and Object.preventExtensions behave the same way (they affect object that inherit from the prototype which is what I want to avoid). */#!/*JoePea __

Re: Object.unfreeze, or similar API

2018-03-24 Thread /#!/JoePea
Hello Oriol, why did you make two Proxies there? Does it serve some purpose not achieved with only one Proxy? - Joe */#!/*JoePea On Mon, Feb 19, 2018 at 12:35 PM, Oriol _ <oriol-bugzi...@hotmail.com> wrote: > > So, what if there was a way to unfreeze an object in the scope in which

Re: Object.unfreeze, or similar API

2018-02-19 Thread /#!/JoePea
and to avoid GC. */#!/*JoePea On Mon, Feb 19, 2018 at 12:08 PM, Michał Wadas <michalwa...@gmail.com> wrote: > You can just do: > > const proxy = new Proxy(obj, { >set() { throw new Error(); }, >defineProperty() { throw new Error();}, >deleteProp

Multi-index assignment.

2017-12-04 Thread /#!/JoePea
] = otherArray[5] // can be array[ ​1​ , ​4​ ] = [ ​ otherArray[3] ​ , ​ otherArray[ ​5​ ] ​ ] ​// but also a shorter form: array[1, 4] = otherArray[3, 5] ``` */#!/*JoePea ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org

Re: Cancel Promise pattern (no cancellable promises)

2017-11-29 Thread /#!/JoePea
C'd, but `somePromise` is not and the above console.log should still fire at some point (or memory will be leaked)? */#!/*JoePea On Thu, Jan 12, 2017 at 1:12 PM, Isiah Meadows <isiahmead...@gmail.com> wrote: > And that's why we're waiting on the next meeting to happen with notes > po

Re: Touch/Trackpad finger position

2017-11-07 Thread /#!/JoePea
. */#!/*JoePea On Tue, Nov 7, 2017 at 4:37 PM, Isiah Meadows <isiahmead...@gmail.com> wrote: > Also, for future reference, these kinds of feature requests belong in the > WHATWG's mailing lists, not here. > > On Tue, Nov 7, 2017, 18:59 Eli Perelman <e...@eliperelman.com> wrote: >

Re: Compiled JS

2017-10-24 Thread /#!/JoePea
What do you mean? Like coffeescript? */#!/*JoePea On Tue, Oct 24, 2017 at 2:06 PM, doodad-js Admin <dooda...@gmail.com> wrote: > Hi, > > > > By seeing many proposals about reducing the syntax for X and Y, I just > want to open the idea of a [non-native] compiled JS wo

Re: Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread /#!/JoePea
I'm not polyfilling Custom Elements, I'm polyfilling something else that doesn't have the problems that Custom Elements has that makes them not usable with SVG. /#!/JoePea On Tue, Oct 24, 2017 at 12:42 PM, Boris Zbarsky <bzbar...@mit.edu> wrote: > On 10/24/17 2:03 PM, /#!/JoePea wrote

Re: Object method shorthand after initial declaration

2017-10-24 Thread /#!/JoePea
`obj.foo() {}` is a syntax error in Chrome, so it seems possible to make that a function definition. /#!/JoePea On Tue, Oct 24, 2017 at 12:45 PM, Brian Blakely <anewpage.me...@gmail.com> wrote: > Is it only valid with a semicolon after `foo()`, though? Pragma without > semicolon thr

Re: Re: Shorter syntax for arrow function assignment

2017-10-24 Thread /#!/JoePea
this prototype object from somewhere ... */ prototype.foo = function foo() { // do something with `this`. } ``` That sort of stuff (relying on non-arrows) isn't going away. /#!/JoePea On Tue, Oct 24, 2017 at 1:12 PM, Brian Blakely <anewpage.me...@gmail.com> wrote: > To be clear, this isn't a

Re: Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread /#!/JoePea
ementation). The idea is that it would work on any type of element because it is really generic (just like jQuery works on any type of element), so patching Element seemed the best way to do it. /#!/JoePea On Tue, Oct 24, 2017 at 11:36 AM, Andrea Giammarchi <andrea.giammar...@gmail.com>

Are Map with no references and their values with no references GC'd?

2017-10-24 Thread /#!/JoePea
or to the Map values. I'm intuitively assuming "yes", but just want to confirm that I don't have to explicitly removed everything from the `Map`s manually first. /#!/JoePea ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/l

Re: Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread /#!/JoePea
, what if browsers come out with `MathElement`, `WebGLElement`, etc. /#!/JoePea On Tue, Oct 24, 2017 at 10:55 AM, Michał Wadas <michalwa...@gmail.com> wrote: >> To "polyfill" an idea I have for DOM, to propose it later, etc. > > You can consider something like this depe

Re: Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread /#!/JoePea
darkness my old friend'); } }; // then ... class MyEl extends HTMLElement {} customElements.define('my-el', MyEl); new MyEl; ``` /#!/JoePea On Tue, Oct 24, 2017 at 10:36 AM, Andrea Giammarchi <andrea.giammar...@gmail.com> wrote: > I know I'm going to regret this already, but since I've s

Re: Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread /#!/JoePea
= document.createElement('div') console.log(div.foo) // it exists and is specific to the instance, not a prototype property ``` Can this be done? /#!/JoePea On Tue, Oct 24, 2017 at 10:19 AM, /#!/JoePea <j...@trusktr.io> wrote: >> This feels like a problem similar to >> https://esdiscu

Re: Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread /#!/JoePea
ds. --- So suppose I want to "polyfill" a concept. For example, I want all elements to have a new "foo" accessor after they've been constructed. Or for example, suppose `HTMLElement.prototype.style` and `SVGElement.prototype.style` didn't exist yet. How would I patch those in? /

Re: Shorter syntax for arrow function assignment

2017-10-24 Thread /#!/JoePea
It can be confusing because it is too similar to non-arrow functions. The arrow syntax is clear in meaning. */#!/*JoePea On Tue, Oct 24, 2017 at 9:51 AM, Brian Blakely <anewpage.me...@gmail.com> wrote: > This syntax is shorter, easier to write, and arguably easier to read. > Wh

Monkey patching constructors in builtin class hierarchies?

2017-10-24 Thread /#!/JoePea
t modifying the global wouldn't have any effect. Is there a way to monkey patch a constructor in the middle of a built-in prototype chain or to otherwise inject construction logic to base classes of existing class hierarchies? */#!/*JoePea ___ es-dis

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

2017-10-21 Thread /#!/JoePea
Here's a new real-world example showing people are naturally expecting ES6 `super` to be dynamic when they copy methods from objects to other objects: https://stackoverflow.com/questions/46306598. It makes sense to assume it would work this way considering how dynamic pre-ES6 is! */#!/*JoePea

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

2017-05-15 Thread /#!/JoePea
guage "feature" of concise methods that makes them not constructable forces library authors to write ugly code who's output is harder to inspect and debug by end developers. /#!/JoePea On Sat, Jul 30, 2016 at 3:04 AM, /#!/JoePea <j...@trusktr.io> wrote: >> The distinction bet

  1   2   3   >