Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why? Because it uses JavaScript? I'd rather stick with my Arduino and use C. I don't get the whole "JavaScript Everywhere" meme, I'd rather use almost any other modern language (note the almost).


I perfectly understand your sentiment. When it comes to embedded systems nothing would beat C in near future especially those systems where safety matters.

The lab I am working with explores different ways to code robotic and embedded systems. From MIT's SCRATCH to Erlang we have used them all. One of the area that we have been exploring is of using functional programming languages to program embedded systems. (For example we coded a robosoccer using Erlang).

Being a Javascript enthusiast I always wanted to be able to write small JS programs that I could use to control hardware. Given that JS has good support for Functional programming languages as well, I wanted to try that as well.

There is no doubt that people are expecting too much from Javascript but I do believe this is a very novel attempt that I see a point in supporting. I do not think JS is a language that will find application in say automotive systems but it can certainly be used to program robosoccer in my lab.


You prefer C over JavaScript? Header files? Pointer arithmetic hell? Precompiler Macros? Manual Memory Management? Seriously?

To each their own, though.


No. I prefer C over JavaScript for embedded devices. And actually in most places, too.

I know I'm weird, but I really like pointers, because I really like being able to manually setup data structures, and enjoy the power provided by pointers.

Manual memory management isn't horribly fun, but for embedded devices I would rather be in charge of that over the chip having to do it for me. It means that if there's ever a memory overflow, it's my own damn fault, and I have the ability to fix it.

JavaScript is an acceptable scripting language. It's not my favorite, but it works. I just don't think scripting languages should really be used on embedded devices.


Sure if you write very low level stuff, C is probably more suitable. I wonder how much today's "embedded devices" still have in common with traditional embedded devices, though? If it is capable of running JavaScript, it probably is a lot more powerful than some microprocessor with just 2KB RAM where you have to squeeze every bit out of your code. On the PI you can run a complete Linux installation. I don't think these devices are actually embedded, they are just smaller than "normal" computers.


JavaScript, and scripting languages in general (and, to be more specific, dynamically typed languages, too, but those tend to be scripting languages, anyways) tend to have a lot of gotchas, and when it comes to controlling physical things, I think that less gotchas are better.

Yes, statically typed languages just put a bunch of metadata in the code, but I think it's useful to have the guarantees provided by a static type system when your controlling things.

Like if you're controlling a robot arm. I'd rather have the type system make sure I don't try to do something stupid, like add a string to an int that's controlling the degree of the arm. Static languages make sure you can't do that, most dynamic language will let you do that.


It would definitely depend on the kind of project (for me at least). I probably wouldn't recommend writing the controller for some medical device in JavaScript. My impression was that devices like the one here are more for tinker projects, making LEDs blink and stuff like that.

Although I also don't agree that statical typing makes things so much more safe. And what can also happen is that in the world of statically typed languages bad workarounds are then invented for the inflexibility. An example would be the XML craziness that plagued the Java world for a long time.


Then just write more unit tests and you'll be fine.


I also prefer C and C++ over every other high level languages when performance is essential.


Not even for scripting them?


There's not really much need for scripting on an embedded device. Embedded systems are meant to do a single task and run continuously. If he is already comfortable with C, he clearly doesn't have much use for a language like Javascript when it comes to microcontrollers.


I would rather use Python for scripting.


On an embedded microcontroller, pointers and manual memory management tend to be less of an issue, as you're doing most of the stuff on the stack. I don't think I've ever had a reason to call malloc in an embedded C application before. If you were doing networking, however, it would probably be much more complicated. In that case, Javascript might be useful. But on the other hand, there are high-level languages that I would greatly prefer over Javascript.


Generally, embedded applications know how much memory is needed at start-up based on the specification. So global memory is statically allocated.


Which ones, though?


Pretty much every one except Perl or PHP.


Like Java, C is deterministic. Try adding a string and an integer in JS, what happens when JS is controlling real hardware, directly, and the coder said do this but the code (JS) does something else? I can't imagine coding medical devices with JS and hoping they always do exactly what their coders thought the JS they wrote would do.


C rules the embedded systems world. By embedded system I refer to the serious applications such as automotive systems and so on and not some funky new toy project done using Arduino.

There are some very good reasons why C can not be replaced by any other programming language when it comes to safety critical embedded systems. That is what separates men from boys.


As long as you write C correctly, which can be verbose when things get complex.

This project seems to be less concerned with the realtime aspect and more concerned with wiring things together. To me it functions as an OpenWRT/RasPi hybrid, with the Node runtime.


When you have a hardware that has got 512KB memory, 5 volt battery and you have to ensure that an event occurs every 10milliseconds it is C which beats JS or any other language hands down.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: