4 ms·
My personal opinion is that good typescript to C transpiller would do a way better job, tons of microcontrollers supported out of the box. I would be also happy
by danielEM 3y ago
My personal opinion is that good typescript to C transpiller would do a way better job, tons of microcontrollers supported out of the box. I would be also happy to use it for desktop. With some tricks it could even support references and additional numeric data types (u8, i8 ... ) without breaking any syntax
- onimishra 3y agoDoes such a thing exist? I would love something like that, but is it even feasible? Isn’t there a lot more you need to be aware of, to make a translation of say TS’s objects into C?
- afiori 3y agoThey would likely have to severely restrict the range of supported types, for example `window` is likely impossible to compile meaningfully.
- danielEM 3y agoThese are far from perfect, but still something: https://github.com/andrei-markeev/ts2c/ https://github.com/andrei-markeev/ts2c/ https://github.com/evanw/thinscript https://github.com/evanw/thinscript If you aim for 32 bit microcontrollers then you can go with assemblyscript to wasm and then with wasm to C transpiller
- simlevesque 3y agoPure Typescript supporting all of the Ecmascript spec would have to output a lot of C to get the same results.
- hutzlibu 3y agoIt obviously would have to be a limited subset, like devicescript is also "just" a subset of typescript. I think the limitations for devicescript would probably also work for outputting reasonable amounts of C.
- devmunchies 3y agoI think a language that just transpiled to the equivalent C would be pretty awesome. I know Google is building Carbon, but it is more focused on C++. They pitch it as Typescript to JavaScript, Scala to Java, Carbon to C++. Instead of Rust or Zig trying to replace C++ or Java, is seems better to just integrate with it without linking through some FFI. I'm working on some C code for some microcontroller since it was too difficult to use Rust.
- impulser_ 3y agoI could be wrong, but doesn't vlang and nim do this?
- SahAssar 3y agoHas vlang managed to get past its controversies and actually deliver on its promises? Last I heard it was still promising too much, under delivering and not handling the feedback too well.
- impulser_ 3y agoI have never used it. I just remember reading on the README that is compiles to human readable C.
- SahAssar 3y agoI that case it might be useful to check previous threads here since vlang has been quite controversial. Or check what they have implemented versus promised.
- Tozen 3y ago>...it might be useful to check previous threads here since vlang has been quite controversial. The majority of controversy has been generated by competitors and detractors using various social media platforms to spread misinformation. To include identified troll accounts created specifically for the purpose of launching such attacks. Something like, "throwing stones and hiding their hands". It would arguably be better to try the language out for oneself, and form one's own opinion, versus allowing known competitors and evangelists who are purposely spreading misinformation to shape one's mind. Just like it is common sense to not expect a used car dealer trying to make sales to give fair and honest opinions or assessments about competitor's cars. > Or check what they have implemented versus promised. Yes, totally agree that the best way is to check something out, and form one's own opinion. Also, these are free open-source languages that we are referring to. People are free to go to their GitHub and make suggestions, discuss, or join the effort to help implement whatever they feel is needed.
- jeppester 3y agoI'm not an expert, but wouldn't garbage collection be a difficult problem as well?
- hutzlibu 3y agoIt would have to include its own garbage collector, yes.