Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #41046

Re: [Proxy] No way to hook property creation?

Path csiph.com!weretis.net!feeder8.news.weretis.net!news.mb-net.net!open-news-network.org!.POSTED.178.197.205.59!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: [Proxy] No way to hook property creation?
Date Wed, 24 Aug 2022 01:45:54 +0200
Organization PointedEars Software (PES)
Lines 77
Message-ID <12054203.O9o76ZdvQC@PointedEars.de> (permalink)
References <nfjfbn7so9tq$.10vkffqwvv24i.dlg@40tude.net> <2658833.mvXUDI8C0e@PointedEars.de> <11i0xqf3yha2p$.mjtrwepd05ys.dlg@40tude.net>
Reply-To Thomas 'PointedEars' Lahn <usenet@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
Injection-Info gwaiyur.mb-net.net; posting-host="178.197.205.59"; logging-data="2079056"; mail-complaints-to="abuse@open-news-network.org"
User-Agent KNode/4.14.10
Cancel-Lock sha1:4YtHTa5e/eTCOrv75lSoqM5Uw9I=
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
X-User-ID U2FsdGVkX19yrx0PMRt7DBvYZ2+doO2J7+T+xl7cblJ6Ty97BmHuOA==
Xref csiph.com comp.lang.javascript:41046

Show key headers only | View raw


JJ wrote:

> On Mon, 22 Aug 2022 01:08:06 +0200, Thomas 'PointedEars' Lahn wrote:
>> is one of the reasons why it is *deprecated* since ECMAScript Edition 5,
> 
> Yet, ECMAScript later added `Symbol.unscopables` to support `with`.

Only to make ES 5− code that still uses “with” for *read* access easily 
compatible with ES 6+:

<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/unscopables>

But:

,-<https://262.ecma-international.org/13.0/#sec-with-statement>
| 
| | LEGACY
| |
| | 14.11 The with Statement
| |
| | NOTE 1: Use of the <Legacy> “with” statement is discouraged in new
                                                 ^^^^^^^^^^^^^^^^^^^^^
| | ECMAScript code. Consider alternatives that are permitted in both
    ^^^^^^^^^^^^^^^
| | strict mode code and non-strict code, such as destructuring assignment.
| |
| | […]

,-<https://262.ecma-international.org/13.0/#sec-conformance>
| 
| A conforming implementation of ECMAScript must implement *Legacy*
| subclauses, unless they are also marked as Normative Optional. All of the 
| language features and behaviours specified within Legacy subclauses have 
| one or more undesirable characteristics. However, their continued usage in 
| existing applications prevents their removal from this specification. 
| These features are not considered part of the core ECMAScript language. 
| Programmers should not use or assume the existence of these features and 
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| behaviours when writing new ECMAScript code.
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| 
| | LEGACY
| | 
| | 2.2 Example Legacy Clause Heading
| | 
| | Example clause contents.

>> and *code containing it cannot even be executed* in Strict Mode.
> 
> I'm using `with`, so I don't use Strict mode in the first place.

PEBKAC.

>> This has nothing to do with the capabilities of the Proxy object because
>> its instance does not even "see" that write access.
> 
> That is correct. It's not supposed to and can not be the job for Proxy.
> And that's the problem, because Proxy doesn't have a way to intercept
> property creation.

1. That is false, as I have demonstrated previously.

2. Again: The Proxy instance is NOT the target object in what only *seems*
   to be a property-write access facilitated with the “with” statement.

>> You can determine whether a property is being created in the “set”
>> handler of the Proxy instance:
> 
> That's not possible, because `set()` will only be called if the JS engine
> already know that the property exists as reported by `has()`.

I have demonstrated that to be false previously, too.

-- 
PointedEars
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2
Please do not cc me. /Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[Proxy] No way to hook property creation? JJ <jj4public@outlook.com> - 2022-08-07 12:56 +0700
  Re: [Proxy] No way to hook property creation? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2022-08-20 17:17 -0700
    Re: [Proxy] No way to hook property creation? JJ <jj4public@outlook.com> - 2022-08-21 14:30 +0700
      Re: [Proxy] No way to hook property creation? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2022-08-21 15:37 -0700
  Re: [Proxy] No way to hook property creation? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2022-08-22 01:08 +0200
    Re: [Proxy] No way to hook property creation? JJ <jj4public@outlook.com> - 2022-08-23 03:31 +0700
      Re: [Proxy] No way to hook property creation? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2022-08-24 01:45 +0200
      Re: [Proxy] No way to hook property creation? TheScreamingFedora <sebaslogo@gmail.com> - 2022-08-25 08:39 -0700
    Re: [Proxy] No way to hook property creation? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2022-08-27 22:40 +0200

csiph-web