Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real preprocessing support #259

Open
ghost opened this issue Dec 19, 2023 · 3 comments
Open

Real preprocessing support #259

ghost opened this issue Dec 19, 2023 · 3 comments

Comments

@ghost
Copy link

ghost commented Dec 19, 2023

Most of C libraries used macros heavily, especially container libraries for C. Adept already included gcc.exe with itself so I think using gcc -E for preprocessing is not a big deal for you.

@IsaacShelton
Copy link
Collaborator

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?

@ghost
Copy link
Author

ghost commented Dec 28, 2023

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.

@IsaacShelton
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant