5 ms·
What language do you think Linux and Arduino should be programmed in?
by raldi 4y ago
What language do you think Linux and Arduino should be programmed in?
- pjmlp 4y agoArduino uses C++, thankfully.
- raldi 4y agoEverything in the top-level comment applies to C++, too.
- pjmlp 4y agoMy "thankfully" remark shows my point of view. The only sin of C++ is the same that plagues evolutionary languages like Typescript, Kotlin and so forth. No matter how many tools they provide to write better code than the language they have grown from, their compatibility with them is like hearding cats while trying to have everyone adopt best practices. Otherwise in regards to Arduino, I would suggest a couple of nice BASIC and Pascal compilers like those sold by Mikroe.
- saagarjha 4y agoIf it was created today? I’d go for Rust and Python respectively
- deleted 4y ago[deleted]
- eric__cartman 4y agoThe ATmega 328P an Arduino Uno or Nano uses has 2KB of memory and 32KB of flash storage for the program. Having some sort of micropython interpreter there would be impossible, and even if it could be achieved, somone still has to write the low level C/ASM code to make it all work. For many embedded systems, low level languages like C or C++ (perhaps Rust for a lot of ARM micros) is the only sensible choice. If it's not a multi user system that's connected to a network, people trying to abuse memory unsafe code isn't a concern.
- deckard1 4y ago> has to write the low level C/ASM code to make it all work shhh. Let's not disturb those that believe in the GC fairy that sprinkles their code with safety magic late at night while they soundly sleep. Firmware doesn't exist. I can't hear you. Na na na na na na na
- pjmlp 4y agoToo late, here is Firmware being written in Go. https://www.withsecure.com/us-en/solutions/innovative-security-hardware/usb-armory https://www.withsecure.com/us-en/solutions/innovative-securi...
- SOLAR_FIELDS 4y agoI hope Rust takes off for embedded programming. I've been working with ESP32 and C is really the only choice if you are doing anything remotely fancy or resource constrained
- Gibbon1 4y agoWhat bothers me about rust is the designers are people that have been bitten hard by working on browsers written in C++ with it's manual memory management and no way to enforce object lifetimes. Rusts solution to that seems like a big hammer when it comes to embedded where you usually have either stack allocated or compile time allocated objects.
- galangalalgol 4y agoIf you code in that style you won't even notice the borrow-checker is there. Unless you have a bunch of shared global state, the the overhead of arc will seem silly on your single core uc.
- Gibbon1 4y ago> bunch of shared global state A good indication of embedded is having to manage shared global state. This is very unlike a browser where you can hide all that behind OS calls.
- raldi 4y agoGuess what Python is written in. https://stackoverflow.com/a/9451956 https://stackoverflow.com/a/9451956
- saagarjha 4y agoIt doesn’t have to be.