List unpacking
- Dominant language
- C++
- Stars
- 251
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Description
It is quite often happens that you know the size of a list and you would want to give its elements names instead of indexing them. Something like:
```jam
local name version = [ MATCH "^(\w+)-(.*)" : $(toolset) ] ;
```
However, that syntax is already taken by multiple assignment operation, so in example above both variables will contain the same value. Is it documented? I had no luck finding anything in documentation about it. May be there is list unpacking already too? Or may be we can repurposed the syntax for it?
I grepped Boost and only found the use in some B2 tests:
```bash
>grep --include "[Jj]am[fr]*" --include "*.jam" -PR "^\s*(local\s+)?+(\w+\s+){2,}=" .
./tools/build/src/build/feature.jam: local p fullp = $(x[1]) ;
./tools/build/test/core-language/test.jam: local v1 v2 = d e f ;
./tools/build/test/core-language/test.jam: local v1 v1 = d e f ;
```
Contributor guide
Research direction
Review the multiple-assignment examples in tools/build/test/core-language/test.jam and the related assignment use in tools/build/src/build/feature.jam. Determine whether list unpacking is documented or intended, then make the behavior or documentation explicit and add or adjust a core-language test for the chosen outcome.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100