On 04/06/2021 8:50 PM, Max Samukha wrote:
On Tuesday, 1 June 2021 at 11:57:34 UTC, Mike Parker wrote:
Dylan Graham writes about his experience using D in a microcontroller
project and why he chose it. Does anyone know of any similar projects
using D? I don't. This may well be the first time it's been employed
in this specific manner.
The blog:
https://dlang.org/blog/2021/06/01/driving-with-d/
Reddit:
https://www.reddit.com/r/programming/comments/nps6k5/driving_with_dlang/
FWIW, I tried D in a simple project using an atmega32a. It almost worked
(thanks to Webfreak and LDC people), but there were a couple of issues:
1. No support for ISRs. I had to implement thunks in C calling D.
2. No slices, because 'length' is typed as 32-bit. Worked around by
accessing the array's elements via .ptr.
3. No foreach (as a consequence of 2, I guess)
Does this form of foreach work?
foreach(i; 0 .. 10)