LLJS icon indicating copy to clipboard operation
LLJS copied to clipboard

Support for ES6-style Classes

Open akrymski opened this issue 11 years ago • 4 comments

Would be nice to go beyond plain C idioms and add support for classes (ES6 style). These can be easily represented as structs under the hood.

A real class system with inheritance and mixins would go a long way to making this far better alternative to C + emscripten. I'd have no issue with writing large web apps in LLJS that way.

akrymski avatar Nov 27 '13 16:11 akrymski

We have support for structs with member functions, but I agree, we could do a lot better here. One path to consider here is building LLJS on top of Typescript.

mbebenita avatar Nov 28 '13 07:11 mbebenita

Indeed, but what about the other way round - convert TypeScript to LLJS? And then LLJS -> C means you get TypeScript -> LLJS -> C -> native in theory :)

akrymski avatar Nov 28 '13 20:11 akrymski

LLJS is not that sophisticated. It can't automatically lower JavaScript semantics into C, it just adds some C like features to JavaScript.

mbebenita avatar Nov 29 '13 03:11 mbebenita

I'm really talking about the LLJS that compiles to asm.js - not the "superset of JS". If you only allow typed JS, then why not just remove "let" and translate "new" to malloc … and get C? what am I missing?)

akrymski avatar Nov 29 '13 16:11 akrymski