Nothingness

Bengt Kleberg eleberg@REDACTED
Thu Oct 25 07:41:06 CEST 2001


> Date: Wed, 24 Oct 2001 16:35:14 -0700
> From: Erik Pearson <erik@REDACTED>
...deleted

> However, this seems at first blush inefficient and cumbersome. Is this 
> true? Perhaps atoms are stored very efficiently? (Of course, the tag 
> atoms could be made shorter as well)

Atoms are stored efficiently.
Atoms use the same space independent upon their length.

> 
> It seems to me that the one solution would be a new disjoint datatype 
> which represents the null value, and which has only one value "null". 
> The null value could be assigned by a primitive null(), values could be 
> tested for nullness with null(Value), and could be stored efficiently.
> 

It would still be impossible to know if you have stored 'null' in the database 
or if you only want to show that this location is empty.

There are (atleast) 2 ways of doing it:
1 Settle upon something (small) that you will never want to store (say: 
undefined, nil, null, false, [], ...) and use this to indicate an empty 
location.
2 Use the scheme you suggested ({value, Value}|undefined) since that way you can 
differentiate between having stored undefined ({value, undefined}) and having an 
empty location (undefined).

bengt




More information about the erlang-questions mailing list