Hacker News new | ask | show | jobs
by whartung 527 days ago
This reminds me back in the day when I was writing a DSL for a project.

Since the data we were getting was sourced from an RDBMS, I wanted NULL to be a first class concept in the DSL, with similar traits.

Early on, I simply made any expression that involved a NULL result in NULL. Naively this was all well and good, but it failed spectacularly in condition statements.

Instead of A = NULL == false, I had A = NULL == NULL. And, as you can imagine, a single NULL in the expression would just pollute the entire thing, and since NULL was considered as FALSE for conditionals, any NULL in an expression made the entire thing, eventually, FALSE.

Naturally I went back and made the comparison operators always return booleans. But it was a fun little side effect at the time.