Tuple elements index access
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
## Abstract
Tuples elements can be accessed with indexes. Let's have it!
## Motivation
Other programming languages have this feature, it's quite useful. I believe code could be more expressive with this feature.
## Specification
Tuple could be called anonymous struct, with both name and field names anonymous. We could use indexes to have access to individual fields:
```solidity
function foo() public view returns(uint256 value, bytes memory data) { ... }
foo().0
foo().1
```
## Backwards Compatibility
Not sure there is any way to make this backward compatible.
Contributor guide
Research direction
The issue proposes index access for tuple elements using syntax such as foo().0 and foo().1, but it names no files, tests, or entry points. Start by locating the compiler areas that parse and type-check tuple member access. Done would require the specified syntax to access individual tuple fields without breaking existing behavior, with compatibility implications resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100