4 ms·
Maybe it's me not understanding dynamic typing etc, but it makes me afraid someon will use my code with object like that: var rope = { color: "red", length: 10
by ajuc 15y ago
Maybe it's me not understanding dynamic typing etc, but it makes me afraid someon will use my code with object like that:
var rope = { color: "red", length: 10 };
- masklinn 15y agoThere's nothing useful you can do against that kind of stuff, so I'd recommend you just document your API correctly and if people want to be stupid, them's the break. I mean nothing stops a java developer from implementing a List throwing some kind of NotImplementedException everywhere (in fact, using `java.util.Collections.unmodifiableList` would be sufficient as that's exactly what it does: throw UnsupportedOperationException on every access to a mutation method, so it's going to blow up any time it's passed to an API which wants to modify the list it's given)