Hacker News new | past | comments | ask | show | jobs | submit login

Perl's DBI module gets around this with a value "zero but true" aka 0E0.

It is useful in cases such as indicating an operation was successful, but zero rows were affected. Using it as a number resolves to zero, using it as a boolean results in true.

I think in the general sense under API though, a status flag is the best way to avoid confusion as you say. Null could just as easily mean 'error' as 'not yet finished'.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: