3 ms·
> don't embrace silent failure modes as a feature. I love Angular and perhaps in some places, and at certain times silent failures make sense (but would a cons
by lucisferre 13y ago
> don't embrace silent failure modes as a feature.
I love Angular and perhaps in some places, and at certain times silent failures make sense (but would a console.log kill you?) but yeah... A-men!
- catnaroek 13y agoThe problem with silent failures is that they are a bad default. Sometimes, the best default is providing no default at all: just throw an exception that must be handled by the programmer. If you want to recover the silently failing behavior, you can always provide a wrapper function that catches the exception and handles it by doing nothing at all. (Admittedly, this is not so easy in nonfunctional languages like JavaScript that make it painful to program with combinators.)
- alxhill 13y agoThe reason Angular has silent failure by default is because failure is designed to happen all the time - this means angular expressions can deal with data that hasn't arrived/hasn't been created yet. This might sound like a bad thing, but it actually makes the page work without confusing the expression syntax with endless or statements. That said, I do see your point - it's frustrating to find something not working due to a typo in an expression, with no errors to point it out. A halfway solution could be some kind of debug directive/tag that logs when an expression doesn't evaluate? Or perhaps something integrated into Angular Batarang? (https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk?hl=en https://chrome.google.com/webstore/detail/angularjs-batarang...)