Re: Proposal: Forced Chaining Operator "!."

2020-05-05 Thread Tobias Buschor
y to support autovivification in a more >> class-based way, like Python does? >> >> >> >> ```javascript >> >> class AutoVivArray extends Array { >> [Symbol.getMissing](identifier) { >> /* if we're here, identifier is not an ownProp

Proposal: Forced Chaining Operator "!."

2020-04-24 Thread Tobias Buschor
Since we now have the "Optional Chaninig Operator" , perhaps a "Forced Chaining Operator" would also be worth considering. I, personally, could use it: let table; table!.user!.id!.type = 'int' will evaluate to: let table; if ( ! ( table instanceOf Object) ) table = {}; if (

Awaiting block expression

2019-06-21 Thread Tobias Buschor
As there are more and more async apis, i would like to have a block, where all promises within automaticly are awaited: Proposal: const image = await { const user = fetch('/user/'+id).json(); fetch('/image/'+user.image).json(); } ___

Re: Small Proposal "!in"

2018-07-19 Thread Tobias Buschor
t; !(a === b) // a !== b >>>> >>> >>> >>>> !(a > b) // a <= b >>>> (!(a > b) && !(a == b)) // a < b >>>> >>> >>> I'm not sure this is relevant to your larger point, and I've already &g

Small Proposal "!in"

2018-06-28 Thread Tobias Buschor
I dont like to write: if ( !('x' in obj) && !('y' in obj) ) { doit() } I was even tempted to write it that way: if ('x' in obj || 'y' in obj) { } else { doit() } What about a !in operator to write it like this? if ('x' !in obj && 'y' !in obj) { doit() }

Re: rest getters and setters (sorry, __noSuchMethod__ again)

2017-07-28 Thread Tobias Buschor
ty, which is the actual > proxy object in this case. > > Updated fiddle: https://jsfiddle.net/2dgefd9d/2/ > > On Fri, Jul 28, 2017 at 5:37 PM, Tobias Buschor <tobias.busc...@shwups.ch> > wrote: > >> wow, you are right! >> >> But this does not work. >>

Re: rest getters and setters (sorry, __noSuchMethod__ again)

2017-07-28 Thread Tobias Buschor
> myItems.getItem3(); > ``` > `this` will be `myItems` because that is how you have called it, meaning > that `getItems3()` will behave just like if you had done `myItems.$3`. > > Your code works as expected in this Fiddle: https://jsfiddle.net/2dgefd9d/ > > On Fri, Jul 28

rest getters and setters (sorry, __noSuchMethod__ again)

2017-07-28 Thread Tobias Buschor
I realy like the possibility to react to dynamic properties, like what you can do with Proxies. But Proxies are not the (my) perfect solution. ``` class items { constructor() { return new Proxy(this, { get(target, name) { if (name[0] === '$') return