[erlang-questions] Re: mnesia and nul data

Wes James comptekki@REDACTED
Fri May 7 22:43:31 CEST 2010


On Fri, May 7, 2010 at 2:31 PM, Geoff Cant <nem@REDACTED> wrote:
> There is no null value in erlang that has any special semantic meaning[1] - by convention we tend to use the atom 'undefined' but you could use anything you like. If your record definitions don't specify default values '-record(some_rec, {foo = default, bar = 12, baz}', then they'll default to 'undefined' (as #some_rec.baz does in that example).
>
> In fact, I would suggest that you use some descriptive atom that notes why there is no value; using 'not_applicable', 'pending', 'waived', 'unknown' has no cost over using 'undefined' and may make debugging data issues easier later.
>
> Cheers,
> -Geoff
> [1] neither erlang nor mnesia implements the awful three-value-logic that SQL uses (true/false/null).


OK thx.

-wes


More information about the erlang-questions mailing list