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
Design C++ namespace scheme #46
Comments
Responses in order of questions:
|
Thank you! That answer solves everything I wanted. I'll go with And I would be happy to expose snake case type aliases. I am sticking with the current case as the default featured one in documentation for my-employer-is-always-right reasons and it matches https://google.github.io/styleguide/cppguide.html#Type_Names, but I sympathize with wanting lowercase names where the surrounding code uses them. |
@dtolnay fair enough! I will say, keep in mind the That said, since you're at Facebook, you might want to reach out to Michael Park and Eric Niebler who are on the C++ committee. They might be able to provide additional guidance regarding C++ API design :) |
#5 and #8 call out that prefixed names like RustString and RustBox are not idiomatic and we should be placing these types in a namespace instead.
Thinking only of the code that I would want downstream to be writing, the style I find most readable is something like:
Some questions for @pravic and @slurps-mad-rips or anyone else:
I have the feeling it isn't appropriate for me to declare a top-level
rust
namespace with familiar type names likeBox
in it. That namespace "belongs" to the official Rust project. Is that feeling correct or is it not so bad?I can define our types in
cxxbridge::rust
and recommend an import downstream to bringrust
in scope when there isn't a collision with something else. Are C++ style guides generally okay with that or would people end up forced to write outcxxbridge::rust::...
all over the place?For the import, as far as I can tell it would be spelled
using rust = cxxbridge::rust;
. Is that right? There doesn't seem to be a way to avoid repeating "rust" such asusing cxxbridge::rust;
.Any other thoughts on the namespace scheme? Thanks!
The text was updated successfully, but these errors were encountered: