6 ms·
What about just agreeing that property getters should not throw? C# for example has similar code-defined properties, but the agreed and recommended practice is
by vesinisa 11y ago
What about just agreeing that property getters should not throw? C# for example has similar code-defined properties, but the agreed and recommended practice is that property getters should never throw.
- orf 11y agoWe could all agree never to have bugs in our code while we are at it as well.
- alkonaut 11y agoThat isn't quite the same thing now is it. There are always cases that may cause a getter to throw (Unpredictable things like OutOfMemory or IO errors), but the point is that they shouldn't be designed to throw. E.g. they shouldn't have "throw new InvalidOperationException("You must connect to the DB before fetching the Data")" exceptions thrown.
- njharman 11y agoyeah, but we don't double check the calling/return of every builtin and we don't double check our double check, recurse. There can be bugs in the OS, or network driver. Life happens. At some point you have to assume something works bug free. A common and reasonable point for that is "I assume language and builtins to actually work as documented".