I'm pretty sure he understands the difference... he's just saying that if it doesn't make the object immutable then it is not that useful.
(I disagree with him. I think minimal variables reassigning makes code easier to understand and 'const' helps to encourage that)
appreciate the effort, but this is really not that useful IMHO.
1 - setInterval is very well known and there should be a real compelling reason to use a custom wrapper api.
2 - the library usage has side-effects... if two dependencies/files use this without coping the instance- things will get unpredictable
3 - you're making SetInterval instances via object copy (prototype design pattern)- the created cloned instance is a new variable, which is what you set out to avoid.
3* - if you prefer objects over the interval return variable, it would have been simpler to use classes (though I still prefer the base API):
class Interval {
constructor(fn, interval) {
this.timer = setInterval(fn, interval);
}
clear() {clearInterval(this.timer);}
}
[comment deleted]amitport 2475 days ago. link 1 point ▲▼
"When will we be not having people that act like that"
Some people are sometimes rude. Some are sometimes condescending. (+ it's a global community and those concepts are not perceived the same universally)
The exchange you linked to does not seem such a big deal to me. (I'm not familiar with the people involved, so maybe I'm missing something)