💾 Archived View for republic.circumlunar.space › users › dbane › gemlog › 2022-02-07.gmi captured on 2024-07-09 at 00:17:33. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

-=-=-=-=-=-=-

Libmir on D

Mir Dlang libraries

D programming language

I have mentioned this a few times as a possible design. However, from testing there are some caveats.

I set a first goal of some safe string manipulation. But with both libmir and a similar package "basic_string", I found I was unable to use "betterC" mode. What *did* work was most of the directives like nothrow, safe & @nogc (but not pure). For some further tasks, I would have to drop more annotations and even rely on the GC. I still think this is better than C, but it does require a change of plans.

It's hard to do better than C in "-betterC" because you have to rely on the standard library, and I don't want to use libmir if I have to drop various annotations and maybe even use the gc. This isn't the end of the world, it just means I have to drag along cii for a little longer. This also confirms my decision to not rewrite in D. There isn't really any payoff until you pass a critical mass. Probably better to improve the C, and write any new code in D. And maybe give serious consideration to just using full D & Phobos instead of libmir?

"C Interfaces and Implementations" library

As a consequence, migrating from C is unfortunately a bit "big bang". Can do the "-betterC" migration fine, but then to really refactor the code requires at least libmir and dropping -betterC (with some other annotations), if not full D. So instead of switching from, e.g. cii to libmir at the same time as reworking code to compile under *betterC*, the initial porting needs to continue using the old libc or cii interfaces until such time as *all* code in the process has been ported. Then "-betterC" can be switched off; and cii replaced with libmir or similar.

Probably still better than the mess that is C, but as usual things take a bit longer than expected.

Back to my gemlog