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

os() platform condition incorrectly defined in prose and language grammar #346

Open
grynspan opened this issue Jan 6, 2025 · 3 comments
Labels
Content issue A problem in with the book's prose, code, or figures

Comments

@grynspan
Copy link
Contributor

grynspan commented Jan 6, 2025

Location

| `os()` | `macOS`, `iOS`, `watchOS`, `tvOS`, `visionOS`, `Linux`, `Windows` |

> *operating-system***`macOS`** | **`iOS`** | **`watchOS`** | **`tvOS`** | **`visionOS`** | **`Linux`** | **`Windows`** \

Description

The lists of valid OS names used with os() are incomplete, as the language supports a variety of other OS names such as WASI and FreeBSD.

Correction

We should either leave the list open-ended, or try to comprehensively list everything the compiler supports.

It's also worth noting that if a developer passes some unsupported OS name, it's not a compiler error—the compiler will accept it, emit a warning, and just ignore the code as if it said false instead of os(whatever). So perhaps the grammar should reflect that, if possible.

@grynspan grynspan added the Content issue A problem in with the book's prose, code, or figures label Jan 6, 2025
@amartini51
Copy link
Member

amartini51 commented Jan 6, 2025

TSPL documents only the platforms that have official support. If some are missing, yes we should add them.

For additional discussion, please see #225 and #245.

@grynspan
Copy link
Contributor Author

grynspan commented Jan 6, 2025

The grammar of the language allows for additional values even if they're not actually supported.

@grynspan
Copy link
Contributor Author

grynspan commented Jan 6, 2025

It would be sufficient to adjust the formal grammar to allow for any identifier token, with a comment to the effect of "these are the supported values; other values will compile but produce diagnostics".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content issue A problem in with the book's prose, code, or figures
Projects
None yet
Development

No branches or pull requests

2 participants