Open ghost opened 8 months ago
I prefer improving the existing preprocessing over using C's preprocessor, C's preprocessor is slow and uses bad semantics for file management.
What is the problem you are trying to solve that the current preprocessing is not sufficient for?
What is the problem you are trying to solve that the current preprocessing is not sufficient for?
Adept is lacking a lot of commonly used data structures and I'm such an idiot that I can't implement them myself. So, I can only try using readily made libraries for C, and these libraries are always using C macros heavily.
I am very busy with other projects at the moment, so it might be a long time, if ever, before they are implemented
To implement containers though, I assume the only thing you're missing is the ability to have different subtypes?
You can create containers like this for example:
record <$A, $B, $C> Tuple3 (a $A, b $B, c $C)
where you can accept polymorphic type parameters (like $A) which can take on any type. Then you supply the types you want when you use the type like: values <int, double, String> Tuple3
And functions/methods use same polymorphic types in the same way pretty much:
func printElements(this *<$A, $B, $C> Tuple3) {
print(this.a)
print(this.b)
print(this.b)
}
func replaceA(this *<$A, $B, $C> Tuple3, new_a $A) {
this.a = new_a
}
just like C++ templates.
If you have any specific container requests though I can try to take a look
The lifetime management of elements is the hard part to get right though since the current lifetime system sucks
Most of C libraries used macros heavily, especially container libraries for C. Adept already included
gcc.exe
with itself so I think usinggcc -E
for preprocessing is not a big deal for you.