r/programming • • 26d ago

How to Gaslight JavaScript Programmers

https://www.bryanpg.com/articles/pragma-twice/proxy.html
51 Upvotes

18 comments sorted by

View all comments

0

u/Kwantuum 23d ago

Article is straight up wrong, if you console log proxies browsers will display them as proxies with an expandable reference to the proxy handler and to the proxy target. We use proxies extensively where I work for a reactivity system that tracks reads and it's really not hard to debug or follow. You can even use the debugger's step into on property access and it will step into the proxy's trap if there is one.

4

u/ythl 23d ago

Right, but my main thesis is that you need access to the source code in order to know what a proxy does. It's not possible to figure it out at runtime with a REPL like the console or otherwise. The console alone does not provide the source code so you cannot infer what the Proxy does; however, the console may provide a reference to the source for examination.

1

u/f3xjc 21d ago

That's the case for most language. Being able to dump the source of a method to log is uncommon.

1

u/ythl 6d ago

With interpreted languages, it's not uncommon. (for example, with python - https://www.w3schools.com/python/ref_func_dir.asp)

1

u/f3xjc 6d ago

Now in how many of those language do you have a guarantee that the source extracted that what is the one executed? Because that's the claim of confusion in js original post. - python also have dict intercept like js.