3 ms·
Despite my usual cynicism about #javascripthipster projects, this does actually look kinda neat. The one thing that rubbed me the wrong way is the "let" keywor
by zx2c4 14y ago
Despite my usual cynicism about #javascripthipster projects, this does actually look kinda neat.
The one thing that rubbed me the wrong way is the "let" keyword. Why can't we just declare variables without it, like C does? I suppose because they want to rely on JavaScript's own scoping rules?
What would be cooler would be if they could just totally do away with making actual JavaScript variable declarations or function calls, save for the set of typed arrays, pushing and popping variables on and off the stack for function calls, and then coming up with some horrible hack for implementing jmps in a language with no goto. I'm sure this wouldn't really make things more efficient, but it'd be interesting to read.
I guess though, there's always the source of emscripten for that delight.
- dasil003 14y agoThis is more of a #javascriptneckbeard project for which I have to give a healthy respect.
- mbebenita 14y agoRelying on JS function calls and variable declarations is actually more efficient in this case since the underlying JS JIT can perform a lot of optimizations (SSA / Register Allocation). We do stack allocation for structs and local variables for which you need to take the addresses of. The "let" keyword is left in there because we wanted to stay compatible with JS. So any JS program is also an LLJS program. This way it would be easy to integrate into an existing code base. As for the "let" vs. "var" debate, we chose "let" because of its block scoping semantics and because we didn't want to let variable declarations alias each other with different types.
- rbanffy 14y ago> The one thing that rubbed me the wrong way is the "let" keyword. Reminds me of 8-bit BASIC. Without the line numbers.