News for hackers. Stuff that matters.
Re:Show HN: ES7 Decorator library adds types checking, memoi... by thomasfoster96 on Sunday May 31, 2015 @09:26AM (#9634086)
Is something similar to this possible with ES6 proxies? It'd be nice to use a lot of these features outside classes, but since proxies are far harder to polyfill (indeed, I don't think anyone's some it yet) I've only seen then done with decorators within classes.
Re:Show HN: ES7 Decorator library adds types checking, memoi... by nawitus on Sunday May 31, 2015 @09:49AM (#9634162)
I once implemented type checking in ES5 as a proof-of-concept: https://github.com/panuhorsmalahti/typed-javascript
Re:Show HN: ES7 Decorator library adds types checking, memoi... by aikah on Sunday May 31, 2015 @09:40AM (#9634134)
you dont need proxies, here is how decorators work and how you can implement them yourself, without the syntactic sugar obviously

https://github.com/wycats/javascript-decorators

Proxies are an entire different thing.

Re:Show HN: ES7 Decorator library adds types checking, memoi... by piran on Sunday May 31, 2015 @09:32AM (#9634103)
No these aren't the same as proxies. ES7 has class decorators that can only be used on class methods.
Re:Show HN: ES7 Decorator library adds types checking, memoi... by thomasfoster96 on Sunday May 31, 2015 @09:39AM (#9634130)
I know they're not the same, but I'd love to be able to use some of the thins I can use with decorators, but on plain objects.
Re:Show HN: ES7 Decorator library adds types checking, memoi... by eltaco on Sunday May 31, 2015 @09:41AM (#9634135)
You can also use them on class declarations themselves and object literals - https://github.com/wycats/javascript-decorators#object-liter...
Re:Show HN: ES7 Decorator library adds types checking, memoi... by mako-taco on Sunday May 31, 2015 @09:38AM (#9634128)
es7 decorators can also be used on vanilla objects, not just classes.
Re:Show HN: ES7 Decorator library adds types checking, memoi... by thomasfoster96 on Sunday May 31, 2015 @09:40AM (#9634132)
Really? Any tutorials/posts/examples of using them on plain objects anywhere?
Re:Show HN: ES7 Decorator library adds types checking, memoi... by mako-taco on Sunday May 31, 2015 @10:14AM (#9634224)
Yeah, check some of the examples in the readme