The title of this thread might be weird, but I am currently
reconsidering the language and tools I am using before returning
to production again.
# Objective and projects
Make simple turn based (no animation) video games using Allegro
4, maybe 5, and eventually SDL on multiple platforms: Linux and
Windows for now, but could expand, if possible, to other OS or
hardware like MacOS, Android, Raspberry Pi, Arduino, etc. I will
also be using Sqlite databases in most of my projects.
I have a set of projects I am decomposing and refactoring. I am
wondering if I should continue in the same direction or if I
should change my tools and languages. I am considering D or
betterC as an alternative.
# Language
I am currently using plain C and I love it. I am allergic to C++
and object oriented programming. Having read a bit about the
features of the D language makes me doubt continuing using the C
language. Especially the betterC option that allows making C
compatible libraries and software using some of the D syntax.
Unlocking for example the use of foreach statements.
The D syntax is interesting, trying to extend the C language the
same way would require macros which is not recommended for many
reasons. The C language evolves very slowly, so I'll probably be
dead by the time they implements foreachs (bools are not even
native to the language yet(requires stdbool.h). With D, I have 2
options: 1) create a D software with the D runtime 2) Create a
betterC software that create C compatible code. I am making both
games and libraries, so making C compatible libraries is almost
essential.
The objective is to have a simple language, without object
oriented stuff, that is relatively productive and allow low level
manipulations. This explains the interest in getting foreachs for
more control, security, less bugs therefore less debugging and
more production.
So again betterC could be a good solution even though it's not
well documented what features is exactly part of betterC. I
wonder if it's worth learning the entire D language since a
majority of the features might not make it to betterC. Also I
have no interest in OOP, which is relatively present in the D
language.
# Cross-Compiling and Interoperability
This is where the troubles are starting. Now I am trying to
figure out what can work together in a cross compiling context.
Some of my projects are currently compiling windows binaries
from linux OS using Mingw on gitlab.
Allegro seems to support both C and D, but if I only use the
better C switch, I should be able to use any C library without
any issue. Sqlite is also a plain C library, it should be usable
with betterC and D.
But how is this possible in a cross-compiling context. I am not
sure if I can do that with the D language either as pure D or
better C. DMD does not seem to offer cross compiling. GDC can
compile better C, but not sure mingw can compile D/betterC code.
So I am not really sure what can be done in cross-compiling, and
if it works for Linux and Windows, it might not work for other
platforms like MacOS, Rpie, Arduino if one day, I decide to take
this route.
So what language do you recommend:
* Keep everything in plain C
* Use C patched with macros to gain some language features like
Foreach
* Use BetterC for everything
* Use D for the games, and better C or C for the libraries(To
keep some compatibilities)
* Use D for everything, no C compatibility.
If you have other suggestions or questions let me know.