Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors how settings metadata (such as compile-time, experimental, or deprecated status) is managed. It removes inline tags from "src/settings.js" and instead defines this metadata programmatically in "tools/settings.py", updating the documentation generator and link-time checks accordingly. A critical feedback item points out that the new type annotation "dict[str, str | None]" in "tools/settings.py" will cause runtime errors on Python versions older than 3.10, which violates Emscripten's compatibility requirements.
|
|
||
| EXPERIMENTAL_SETTINGS = { | ||
| # Experimental settings. Values with a message string also emit a warning at link time. | ||
| EXPERIMENTAL_SETTINGS: dict[str, str | None] = { |
There was a problem hiding this comment.
Using dict[str, str | None] as a type annotation will cause a TypeError at runtime on Python versions older than 3.10 (due to the | operator) and older than 3.9 (due to the use of dict as a generic). Since Emscripten supports Python 3.6+, this will break compatibility for users running older Python versions. It is safer to omit the type annotation or use typing.Dict and typing.Optional if type hinting is desired.
| EXPERIMENTAL_SETTINGS: dict[str, str | None] = { | |
| EXPERIMENTAL_SETTINGS = { |
…gs.py`. NFC Remove `[link]`, `[compile+link]`, `[compile]`, `[deprecated]`, and `[experimental]` tag comments from `src/settings.js` and generate those documentation notes in `tools/maint/update_settings_docs.py` directly from `tools/settings.py`. Add `COMPILE_ONLY_SETTINGS` (containing `INLINING_LIMIT`) so compile-only settings stay distinguished from compile+link settings in Python without changing generated docs. See: emscripten-core#28311
913ced6 to
4485440
Compare
Remove
[link],[compile+link],[compile],[deprecated], and[experimental]tag comments fromsrc/settings.jsand generate those documentation notes intools/maint/update_settings_docs.pydirectly fromtools/settings.py.This avoid duplicating information between the explicit list in
settings.pyand the tags insettings.js.There used to be more value in having these tags in
settings.jsco-located with the setting, but these days the source of truth that folks should be referring too is the web site: https://emscripten.org/docs/tools_reference/settings_reference.htmlSee: #28311