That way one can easily interface with C/C++, becuz everything remains unboxed.
Name:
Anonymous2014-04-27 10:47
You use what's called NaN tagging or NaN boxing. Basically, if all the bits are set in the float's exponent field, it indicates a NaN. At that point you can store whatever you want in the mantissa. With single precision floats you can't do much with the remaining 23 bits, but doubles have 52 bits to play with, more than enough to hold a pointer and a small tag.
The logic is pretty simple: If an atom is a number, then you use it directly. If it's a NaN, you check the tag then mask off the upper bits and use it as you wish.
Alternatively, one can break memory into 2^N sized chunks, putting the corresponding tag into the first byte of every chunk. That way memory address itself would tell the type.
Name:
Anonymous2014-04-27 10:59
>>7 that doesn't help you unbox the doubles, though, which is what >>1-san was asking about.