3 ms·
C and Rust solve exactly the same problems as any other programming language in the embedded context: they try to interface with real world. Whether they're com
by anilakar 8y ago
C and Rust solve exactly the same problems as any other programming language in the embedded context: they try to interface with real world. Whether they're compiled or not rarely matters, when software updates are done by reflashing the whole device.
Edit: If you have a device with enough computing power to run a scripting language interpreter, you can use Python in most cases.
- simias 8y agoI agree with the parent, C and Rust are not scripting languages, Lua is. The frontier between what does and does not constitute scripting is admittedly blurry these days but in the case of these languages it's fairly clear cut IMO. Lua is very dynamic, easy to code for (syntactical quirks aside, I'm talking from a "cognitive load" standpoint) while C and especially Rust are a lot more static, require more careful coding but can result in faster and, at least in the case of Rust, more robust code. Lua is the type of language you embed in your C app to make it configurable.
- anilakar 8y ago>easy to code for (syntactical quirks aside, I'm talking from a "cognitive load" standpoint) That's not a fair comparison. A large chunk of the cognitive load comes from the awkward syntax and other design decisions that stem from it. >Lua is the type of language you embed in your C app to make it configurable. Situations where configuration files aren't sophisticated enough but a Python interpreter is too heavy are few and far between.
- simias 8y agoSyntax is very subjective and a matter of taste and familiarity. I don't really like Lua's syntax but from a cognitive load standpoint it's still your average dynamically typed, garbage collected scripting language. Syntax notwithstanding it's easier to code for than C's unmanaged and unchecked runtime or Rust's complex type system and borrow checker. >Situations where configuration files aren't sophisticated enough but a Python interpreter is too heavy are few and far between. That's not the point I was making and I'm not trying to get into a language war between Lua and Python, I have no horse in that race.
- adwn 8y ago> easy to code for ([...] I'm talking from a "cognitive load" standpoint) I strongly disagree. The unfortunate design decision of folding arrays into hashtables forces you to be very careful when you conceptually need a sequential list, because if you store a null value in it, you cut your list in half. Ooops. An array is the most basic, simplest, most useful non-scalar datatype there is, and Lua bungles it.
- saagarjha 8y agoC and Rust are usually used for firmware-level components, while Lua is convenient to provide as a way to provide a lightweight way to provide scripting.