Giter Club home page Giter Club logo

Comments (5)

 avatar commented on August 10, 2024

I guess the only way to properly solve this is to use the following ES6 technique, following this Stack Overflow post:
http://stackoverflow.com/questions/20147081/javascript-catch-access-to-property-of-object
and
http://wiki.ecmascript.org/doku.php?id=harmony%3adirect_proxies

Edit: The sad thing is that it's not supported by Node.JS at the moment. We might want to take a look into Babel's way of translating this feature; so that we can do it on our own in Arsenal, without relying on babel.
Edit: Even sadder... support cannot be brought through observing Babel:

Unsupported feature
Due to the limitations of ES5, Proxies cannot be transpiled or polyfilled. See support in various JavaScript engines.

I wanna cry :'(

from arsenal.

rahulreddy avatar rahulreddy commented on August 10, 2024

😞 that hurts.
We wouldn't want to mess with Object's prototype chain either.

from arsenal.

 avatar commented on August 10, 2024

I'm completely not against such kind of metaprogramming, and that's the only way I see that would have allowed to keep the current API, while ensuring that using an undefined error name would have used either a "default error" or failed early.

That might be my dark metaprogrammer side talking here, but I love simple APIs that are powerful :D

from arsenal.

 avatar commented on August 10, 2024

This is where static analysis is supposed to shine. I'll try to look into that in my free time.

from arsenal.

 avatar commented on August 10, 2024

Indeed, it's yet another track to follow, but still, this means setting up a tool in all projects to ensure that this one is used properly. I'd rather have it self contained with black magic ^^'

from arsenal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.