3 ms·
Why JavaScript? Why not some other DSL, and if you need you can convert a subset of ES6 to that DSL? JS has some features that wouldn't make it ideal (e.g. no
by armchairhacker 5y ago
Why JavaScript? Why not some other DSL, and if you need you can convert a subset of ES6 to that DSL?
JS has some features that wouldn't make it ideal (e.g. no difference between ints and floats). I don't think it would be hard for developers to learn slightly different syntax.
If it's a big subset or the full language, I can see the benefits of using existing JS apps. But with a small subset and presumably for a small computer, I don't think most of those apps would work anyways.
- raxxorrax 5y agoJS certainly isn't ideal for µC, but it can work as shown here. A problem in the embedded world is finding developers as it is, maybe this could help? I believe Arduino has a C++ transpiler. I would almost prefer Javascript here, although you could just use C as a subset.
- pjmlp 5y agoArduino has a C++ compiler, whatever the scripts are called, they are a plain C++ library. Plenty of modern µC, e.g. ESP32, are more powerful than computers like these ones, https://en.wikipedia.org/wiki/PC1512 https://en.wikipedia.org/wiki/PC1512 As exercise for the reader check the programming languages available up to MS-DOS 6.22. It is about time to move on from the mindset that µC are only PICs with 4 KB.
- raxxorrax 5y agoIt has never been a question of computing power or memory, that was already solved decades ago. It is a question of fitting the µC to the application. Price and power consumption are usually the qestions to be answered. 0,50$ or 2$ chip still makes a difference. I think ESPXXXs usually have < 500kb ram. Still quite tight.
- pjmlp 5y agoThe ESP32 has more memory than the PC linked above. COM executables were 64KB, and EXE could use as much as they wanted from 512 - 640 KB in multiples of 64 KB, minus the MS-DOS resident size. Naturally stuff like HMA came later into play with MS-DOS 5, which wasn't something that MS-DOS 3.3, again from the PC above, was capable of. Or if you prefer, I refer to what was possible with 64 - 128 KB on Timex 2068, Spectrum 128 +3A (with CP/M), Commodore 64 with GeOS,... Which, yes games would be coded in Assembly, there was business stuff being sold and coded in BASIC, Pascal, Forth,...
- breakfastduck 5y agoWhy? Because the author wanted to make this project using JS & likely had a specific use case in mind. Plus there are many people comfortable with the language. Why not some other? You're free to build one yourself for whatever language you choose.