owning-ref-rs
cxx20-modules-examples
owning-ref-rs | cxx20-modules-examples | |
---|---|---|
5 | 5 | |
357 | 56 | |
- | - | |
0.0 | 4.7 | |
7 months ago | 5 months ago | |
Rust | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
owning-ref-rs
-
New C++ features in GCC 12
Increasingly feeling that Rust is like Elm: a language with novel ideas, teaching valuable lessons (a vocabulary for teaching and checking thread safety, documenting exclusive vs. shared mutability in the type system, arguably a vocabulary for teaching and checking memory safety, though that comes at a steep cost), yet so stubborn the community treats its values (avoiding shared mutability) as moral judgments of code, and the language and deliberately obstructs writing code outside of approved patterns (single ownership tree, exclusive mutability). struct{Cell...}& doesn't need to be harder to use than C++ struct{T...}*, but Rust keeps it difficult because the community views it as bad code design and wants to keep it hard. And *mut T lacks RAII unlike C++'s unique_ptr, and requires unsafe blocks in every dereference. As a result, people turn to unsound patterns like https://github.com/kimundi/owning-ref-rs, https://github.com/mcoblenz/Bronze/, and https://github.com/emu-rs/snes-apu/blob/master/src/smp.rs#L5....
It's a good language to learn. I hesitate to consider it a replacement for asm/C/C++. Writing rust is hoping that the code you're porting to rust can adapt well to the restrictions, and if not, searching for esoteric and needlessly unsafe/verbose workarounds.
-
Unsoundness in owning_ref
Note that there are other soundness issues that require more fundamental changes to be fixed.
-
Self referential return type -> (Owned, Ref<'a>)
That's a shame. I dug into owning_ref, and it looks like it has an open soundness bug as well.
cxx20-modules-examples
-
C++ Modules: The Packaging Story
build2 use the module mapper API which was available long before 2021: https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper... You can try the examples here https://github.com/build2/cxx20-modules-examples/ with GCC 13 or 12 to confirm, if you wish.
> given communication APIs for GCC just landed in its main branch a month ago
Can you elaborate on what are these "communication APIs"?
-
New C++ features in GCC 12
It you are looking for news on C++20 modules support, then sadly, there is not much progress since GCC 11. I've re-tested my modules examples[1] a few days ago with the GCC 12 snapshot, and while a few bugs have been fixed, the majority remain unfixed[2].
[1] https://github.com/build2/cxx20-modules-examples
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
-
Experiments with modules
I used a build2 repository containing C++20 Modules hello-world projects setup in different scenario with module partitions, without partitions, libraries or not etc. They all just print hello world but the point is to check and show very basic modules usage.
-
GCC 11.1
If anyone is looking for a build system to try C++20 modules with GCC, there is build2: https://build2.org/blog/build2-cxx20-modules-gcc.xhtml
There is also a repository of module examples (some trying to imitate real-world usage like distributing modules as part of a library): https://github.com/build2/cxx20-modules-examples/
-
When do you think modules will be fully implemented?
Here is a set of examples that exercises major modules features: https://github.com/build2/cxx20-modules-examples
What are some alternatives?
tokio - A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
AStarDemo - A basic A* example ported to C++/WinRT
once_self_cell - Safe-to-use proc-macro-free self-referential structs in stable Rust.
cxx20-modules-examples - C++20 modules examples
string - Rust String type with configurable byte storage.
fmt - A modern formatting library
owning-ref-unsoundness - An article explaining the unsoundness I found in owning-ref
Bronze
test-dll-modules-visualstudio - Shows an example of Visual Studio projects with a dll project exposing a module and an executable using the module from the dll.
advisory-db - Security advisory database for Rust crates published through crates.io
docs - conan.io reStructuredText documentation