Proxies / meta programming in js

Proxies / meta programming in js
0.0 0

#1

So once again I was starting to feel like I had a good understanding of javascript, then yesterday I came across this article: http://2ality.com/2014/12/es6-proxies.html
Needless to say I quickly felt like lost. So I had a few questions for the handful of pros on here.

  1. Do you ever use these?
  2. Can you give me good case examples?
  3. Is this something worth understanding?
    It seems to me this would be good to use for some security measures and logging but not much else. Am I wrong?
    Thanks in advanced. :slight_smile:

#2

I don’t… yet.

You can see some great use cases here. What it will generally allow us to do is redefine some syntax to suite our needs. This could have profound implications for how libraries are written and how we implement them, but unless you’re writing an extensive API, I doubt you’ll use proxies at all.

I wouldn’t put it high on any priority list, but I can’t say it’s not worth understanding.


#3

I think you should learn based on necessity. If you don’t need proxies for anything, this stale knowledge will soon be forgotten. That’s why most programming books are horrible introductions to programming, because you learn with no purpose, programming is something that you pick up along the way according to your needs. If you build your career towards information security, your knowledge will be entirely different from someone who focuses on system’s programming.

The same can be said for javascript, if you build libraries and API’s you will naturally stumble upon metaprogramming, it’s not the type of thing you need to know. If you’re curious and you want to learn just for the hell of it, go ahead, but don’t think that you should know every detail of computer science, abstraction is bliss. Just worry about doing whatever it is that you’re doing as well as you can, looking at how other people did it, etc…


#4

Thanks for the input, but those examples are very abstract and I was hoping to see some “real world” examples.
@GregoryGoncalves Thanks for your input. The main reason for my post was to see if there maybe some overlap in with my current “career path”. I always enjoy finding new things and like to read up on them so that I can at least say I’m aware of it, should it ever come up at an interview or something. :smile: