I have been using LiveScript for quite a while now, and I have noticed that in situations where undefined would be implicitly returned, the expression void 8 is used instead.
Naturally, I understand the use of void, but I cannot figure out why specifically the integer 8 is used.
For an example, the following LiveScript:
x = if truthy then \success!
Will compile to:
var x;
x = truthy ? 'success!' : void 8;
From the documentation on LiveScript, here's their reasoning for using
voidrather thanundefined:As for the
8, it's an arbitrary number, and could have been set to any other. As per discussion in the comments below, the reason for this particular arbitrary number is because LiveScript is a fork of coco, whose wiki reports:Regardless of how the developers chose the value, broadly speaking, it's just what the LiveScript
voidcompiles to. There just has to be some expression evaluated by thevoidcall.