3 ms·
I'm looking forward to ROS2 using DDS, which will give zero copy IPC for nodes on the same computer. [1] I wouldn't say that Rust is bad at talking about compi
by Symmetry 12y ago
I'm looking forward to ROS2 using DDS, which will give zero copy IPC for nodes on the same computer. [1]
I wouldn't say that Rust is bad at talking about compile time versus runtime, just that Nimrod is better. This throws a compile error in Rust, for instance:
static FOOBAR: int = if 2i > 1i { 10 } else { 20 };
But this doesn't in Nimrod:
when 2 > 1:
const FOOBAR = 10
else:
const FOOBAR = 20
And that's all because Nimrod added this 'when' keyword distinct from 'if' for stuff that gets computed at compile time. I wouldn't need something like that in a non-embedded context (I guess it's used for specializing to a given operating system by the creator?) but I'll happily use it.
[1]http://design.ros2.org/ http://design.ros2.org/
- dom96 12y agoKeep in mind that Nimrod will also try to evaluate normal code at compile-time, so the following will work fine: const FOOBAR = if 2 > 1: 10 else: 20
- Symmetry 12y agoWhat I'd actually be doing is more like: when ROBOT_VER == 32: type TSonarAddresses = array[0..3, int] const sonarAddresses: TSonarAddresses = [1,2,3,4] ... elif ROBOT_VER == 33: ... and stuff like that.
- dom96 12y agoI see. Good, that is precisely what 'when' should be used for :)
- rurban 12y agoThis is called "constant folding", and every better compiler should do that.