Add a target-specific declarations example
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
## Why
Wave supports `#[target(...)]` declarations for selecting code by operating system and architecture, and the frontend has regression coverage for filtering complete declarations. There is no small maintained example showing how application code should use the feature.
## Scope
Add a focused example under `examples/` that defines the same small interface with target-specific implementations selected by `#[target(os="...")]` and/or `#[target(arch="...")]`.
The example should:
- contain at least two target-specific declarations;
- keep target-dependent code small and observable;
- avoid direct platform syscalls so the example is about declaration selection rather than OS APIs;
- include comments explaining which declaration is selected for each demonstrated target.
Use only target conditions already supported by the compiler.
## Completion criteria
- [ ] The source passes `wavec check` for the normal host target.
- [ ] Focused CI or documented commands check the example for at least two supported targets without requiring cross-target execution.
- [ ] Only the declaration matching the selected target participates in compilation.
- [ ] The example does not duplicate a full platform provider or introduce new target syntax.
- [ ] The example is listed in the examples index or local README.
Contributor guide
Research direction
Start by inspecting the existing examples and the examples index or local README to find the appropriate location and format. Run `wavec check` for the host target, then follow or document focused checks for two supported targets; done means target-specific declarations compile selectively and the example is indexed without adding new syntax.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100