Uh oh!
There was an error while loading. Please reload this page.
Add graphics subsystem - #129
Conversation
piranna
commented
Aug 4, 2016
Why are you using symbols everywhere? Doesn't makes it the code more El 4/8/2016 23:16, "facekapow" notifications@github.com escribió:
|
facekapow
commented
Aug 4, 2016
Well this PR was accidentally submitted, it's now #130, but yeah, I could change the symbols to underscored properties, I just thought that maybe new APIs should use new features, like Promises instead of callbacks or Symbols instead of "private" underscored properties. |
piranna
commented
Aug 4, 2016
For private attributes I find cleaner to use Object.defineProperty(), or to El 5/8/2016 0:17, "facekapow" notifications@github.com escribió:
|
iefserge
commented
Aug 5, 2016
Looks like symbols are as fast as regular properties in v8 now, nice! |
piranna
commented
Aug 5, 2016
Good to know :-) It's just that their lexic seems to be a little bit cumbersome... :-P That's the only objection I have for them :-)
I don't know WeakMap, but code gets as clean as using private attributes and priviledged functions in the constructor without the memory waste. Object.defineProperty() I read it was slower when they were set enumerable=false, that's just what's interesting to use to define "private" attributes and functions... I try to use priviledged functions on the constructor were possible so only it's exposed the public API, and if I need to access to internal structures on subclasses or for testing I use defineProperty to define non-enumerable getters for that info. For me, clean, powerful and easy to use APIs is the top priority. |
Yeah, performance is also important |
facekapow
commented
Aug 5, 2016
Well, either way, trying to have "private" properties in JavaScript is pretty much useless, anyone determined enough could get them. You can get symbols with There is a proposal for ES7 or ES2016 (or whatever it's going to be called) for private properties (which are really more like protected properties in C++ terms), which stores all it's private properties in a private |
piranna
commented
Aug 5, 2016
El 5/8/2016 14:16, "facekapow" notifications@github.com escribió:
The point is to not export the WeakMap...
That's what I was asking for, a private WeakMap at the module level. You |
facekapow
commented
Aug 11, 2016
Any thoughts on the API itself? |
iefserge
commented
Aug 11, 2016
@facekapow#130 is the latest code? Going to comment in the PR. |
Adds a `graphics