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

Feat/286/std expected #340

Merged
merged 43 commits into from
Feb 3, 2025
Merged

Conversation

jowillianto
Copy link
Contributor

No description provided.

@liuzicheng1987
Copy link
Contributor

Hi @jowillianto,

Thanks for the PR. I look forward to having this in the library.

However, the tests fail to compile. Should be an easy fix, though. Could you take a look?

@jowillianto
Copy link
Contributor Author

I will try my best to fix these for linux and macos first. My main machine is a macbook pro. In the end, if I cannot fix for windows, please help me.

@liuzicheng1987
Copy link
Contributor

@jowillianto , I will take a look tonight

@liuzicheng1987
Copy link
Contributor

@jowillianto, the tests and benchmarks now compile and run through.

@jowillianto
Copy link
Contributor Author

Thanks. I was setting up environments.

@jowillianto
Copy link
Contributor Author

So what should we do now? @liuzicheng1987

@liuzicheng1987
Copy link
Contributor

@jowillianto, I think there are two more things to do:

  1. We need a formal testing pipeline for C++-23.
  2. We need to remove the result type from all .src files and move them into the headers files, otherwise users might experience confusing linking errors.

@jowillianto
Copy link
Contributor Author

jowillianto commented Feb 1, 2025

I think running the tests by compiling it in both cpp23 and cpp20 should serve the purpose. Additionally, I think we should compile while projects in the same cpp version otherwise linking errors or what I experience is everything works but incorrect behaviour.

@liuzicheng1987
Copy link
Contributor

liuzicheng1987 commented Feb 1, 2025

@jowillianto , I dug a bit deeper and found that a lot of the weird compilation and runtime errors we have been getting is that the compiler was mixing the old result type with std::expected. Because a "Result" wasn't the same across different compilation units we were getting all kinds of weird errors. I have found that designing it as an explicit opt-in resolves at least some of the issues.

@liuzicheng1987
Copy link
Contributor

liuzicheng1987 commented Feb 1, 2025

@jowillianto, you said your main machine is a MacBook Pro. I wonder, how did you compile it? I cannot get this to compile with Clang. It appears they don't fully support std::expected yet, so now I only test for GCC.

@jowillianto
Copy link
Contributor Author

jowillianto commented Feb 1, 2025

@liuzicheng1987
I have used llvm-17 to compile reflect-cpp up until now, I have tried compiling with llvm-18 and llvm-19. Up until now, llvm-17 seems to be the most stable with the least abi bugs. llvm-18 have a problematic clangd that complains about abi bugs all the time. While, llvm-19 sometimes does not compile the code.

@liuzicheng1987
Copy link
Contributor

liuzicheng1987 commented Feb 2, 2025

@jowillianto , I can compile the library and the tests locally using Clang-19 without any issues. The tests pass. However, the Github Actions build pipeline does not seem to be ready for Clang-19 quite yet.

That being said, I think this is ready to be merged. Do you agree?

Thank you so much for contributing this.

@jowillianto
Copy link
Contributor Author

I will look at this one last time tomorrow. I'll leave a comment when I am done. :)

…cxx23) and REFLECTCPP_USE_STD_EXPECTED=OFF(cxx20). This allows compilation even for projects that does not specify CXX version
@jowillianto
Copy link
Contributor Author

jowillianto commented Feb 3, 2025

I added a version switch for CXX20 and CXX23 in CMakeLists.txt because it apparently does not compile without specifying any options. @liuzicheng1987. Otherwise, the tests should have covered most of the things.

@liuzicheng1987
Copy link
Contributor

@jowillianto, I see...I actually updated all relevant parts of the documentation to explicitly include definitions of the standard:

0533312

I think this is probably the better solution anyway, because it allows people to specify the standard they want. But your solution is good as well. Should I revert the relevant changes to the documentation or should we simply revert your last commit?

@liuzicheng1987
Copy link
Contributor

liuzicheng1987 commented Feb 3, 2025

@jowillianto, another solution would be something of the order "If the standard is not explicitly defined by the user, then use 20 or 23."

@jowillianto
Copy link
Contributor Author

jowillianto commented Feb 3, 2025

This should be good to go now !

@liuzicheng1987
Copy link
Contributor

I'll just wait for the tests to run through, just as a matter of formality, and then I will merge.

@liuzicheng1987
Copy link
Contributor

@jowillianto , thank you so much for your contribution.

@liuzicheng1987
Copy link
Contributor

@jowillianto , sorry, fat fingers...

@jowillianto
Copy link
Contributor Author

Likewise, it is a good experience working with repository this big. This is probably my first time. However, I really like the modern functional-style design principles. I hope more C++ code can have such modern design principles.

@liuzicheng1987 liuzicheng1987 merged commit 6d51c12 into getml:main Feb 3, 2025
22 checks passed
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

Successfully merging this pull request may close these issues.

2 participants