Skip to content

Update diplomat to using cpp lib name#581

Merged
Manishearth merged 4 commits intoboa-dev:mainfrom
Manishearth:cpp-lib-name
Sep 18, 2025
Merged

Update diplomat to using cpp lib name#581
Manishearth merged 4 commits intoboa-dev:mainfrom
Manishearth:cpp-lib-name

Conversation

@Manishearth
Copy link
Copy Markdown
Contributor

@Manishearth Manishearth commented Sep 18, 2025

Manishearth added a commit to rust-diplomat/diplomat that referenced this pull request Sep 18, 2025
Fixes #688, fixes #920. Projects are strongly encouraged to use this to
avoid namespace pollution.

With this change, C++ projects setting `lib_name` will use that as a
toplevel namespace. Further namespaces produce sub-namespaces (e.g.
ICU4X could have `lib_name = icu4x` and `namespace = properties` on some
of its code for `icu4x::properties::blah`)

Switching from namespaces to lib_name does not change the actual code
too much EXCEPT `diplomat_runtime.h` will now be `libname::diplomat` and
will have a lib-scoped include guard. This is overall better for
everyone.


This does not affect the nanobind backend, currently. Followup:
#957

See this in action:

 - ICU4X: unicode-org/icu4x#6957
 - temporal_rs: boa-dev/temporal#581
@Manishearth
Copy link
Copy Markdown
Contributor Author

Manishearth commented Sep 18, 2025

Note: this moves Diplomat over to a git hash. I can cut a release pretty quickly when needed, but I don't want to preemptively do that, to minimize the number of breaking changes between now and ICU4X 2.1, so we don't have to do another breaking diplomat release when ICU4X 2.1 comes out.

@nekevss
Copy link
Copy Markdown
Member

nekevss commented Sep 18, 2025

How long until ICU4X 2.1?

@Manishearth
Copy link
Copy Markdown
Contributor Author

@nekevss mid-October.

To be clear, this does not block us on ICU4X 2.1. I am merely hoping to wait until the last moment for Diplomat 0.13.0 so that if there are other breaking Diplomat changes they can make their way in. When temporal_rs needs a Diplomat release for 0.1.0, I'll make one, and when ICU4X needs a Diplomat release hopefully we can make a minor release but if not we can always make a major one.

@Manishearth Manishearth merged commit abf3d37 into boa-dev:main Sep 18, 2025
8 checks passed
@Manishearth Manishearth deleted the cpp-lib-name branch September 18, 2025 22:38
hubot pushed a commit to v8/v8 that referenced this pull request Sep 19, 2025
Prepares the code for boa-dev/temporal#581

This will make it easier for multiple Diplomat-based projects to
coexist in the same project (necessary if we ever move the Intl code
over to ICU4X).

The only real change is that the `diplomat` namespace is now
`temporal_rs::diplomat`

Bug: 401065166
Change-Id: I6a6a6964b68b8e82af2247bb5d5573725c4fb3dd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6967084
Commit-Queue: Manish Goregaokar <manishearth@google.com>
Reviewed-by: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#102614}
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