There’s nothing wrong with “delete” semantics of returning true when target is already deleted. It’s a valid point of view on this operation with idempotence in mind. It could have been implemented another way around, yes, but it would’ve meant the same kind of inconveniences but for another set of use cases. 9:57
The is a problem with the delete returning true when the operation wasn't done is that, if it is already deleted and still returning true to me, it is lying to me. It is saying that, in some usecase which i'm deleting an property means that i'm expecting that property to exists. If not, then, there is something wrong before the delete and it may leads to future bugs. It should throw an error, not returning true to me.
This talk is amazing! Leaned a lot about JS and its internals.
eval is awesome!
I didn't understand the symbols example where can I find the code
Source code from Dave’s github:
github.com/davefancher/js-metaprogramming-old
There’s nothing wrong with “delete” semantics of returning true when target is already deleted. It’s a valid point of view on this operation with idempotence in mind. It could have been implemented another way around, yes, but it would’ve meant the same kind of inconveniences but for another set of use cases. 9:57
The is a problem with the delete returning true when the operation wasn't done is that, if it is already deleted and still returning true to me, it is lying to me. It is saying that, in some usecase which i'm deleting an property means that i'm expecting that property to exists. If not, then, there is something wrong before the delete and it may leads to future bugs. It should throw an error, not returning true to me.
@@matheuss7348 I don’t remember the context of this comment anymore. But always: it depends