Add a focused generics example
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
## Why
Generic structs, generic functions, nested type arguments, and generic method specialization are covered by parser/compiler tests, but there is no small maintained example dedicated to teaching the feature.
The existing WebAssembly smoke example uses generics as one feature among many, which makes it a poor reference for someone learning the syntax.
## Scope
Add a focused runnable example under `examples/` that demonstrates the currently supported generic syntax without introducing unrelated platform or standard-library behavior.
Include:
- a generic `Box`-style struct;
- a `Pair`-style struct with two type parameters;
- a generic function called with an explicit type argument;
- construction and field access for generic structs;
- at least one nested generic type such as `Pair>`.
Keep the example aligned with the syntax and semantics already covered by the frontend generic tests.
## Completion criteria
- [ ] The example passes `wavec check` and runs successfully on a normal hosted target.
- [ ] It demonstrates more than one concrete generic instantiation.
- [ ] Nested generic type arguments are included without turning the file into a stress test.
- [ ] No unsupported generic feature is documented implicitly.
- [ ] The example is listed in the examples index or local README.
Contributor guide
Research direction
Start with the frontend generic tests and the existing WebAssembly smoke example to confirm supported syntax, then inspect the examples/ layout and its index or local README. Add the focused runnable example covering the listed instantiations, run `wavec check` and the example on a hosted target, and verify that it is indexed.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100