2 ms·
At this point I'm not sure whether I don't know how to use this because I don't write JavaScript, or I don't write JavaScript because of stuff like this. In al
by Toutouxc 6y ago
At this point I'm not sure whether I don't know how to use this because I don't write JavaScript, or I don't write JavaScript because of stuff like this.
In all seriousness, this looks like a massive footgun and feels to me like something you wouldn't want to use in what's essentially a duck-typed language. Or is there something this Ruby lover is missing?
- jmull 6y agoI think the post is making this seem more complicated than it is. (Not a criticism of the post -- it's interesting to explore edge cases sometimes.) The general takeaway is private fields are private, and the "in" operator is consistent with that. If constructor code results in an incorrectly constructed object, that's simply a bug in the constructor code, not really anything specifically to do with fields, private fields, in operator, etc. (I guess this is a criticism of the post. Bringing this up implies it's somehow relevant to the topic, but it isn't and causes confusion.)