FuelLabs / FuelLabs/sway

Index and IndexMut trait.

Open
#429 0 comments 1 reaction 0 assignees View on GitHub
compiler enhancement language feature lib: std P: low team:compiler
Dominant language
Rust
Stars
61.4k
Forks
5.4k
Avg merge
3h 33m
Merged PRs (30d)
4

Description

#424 introduced static arrays and indexing them though indexing other types we need the `Index` and possibly `IndexMut` traits. These would mimic the Rust equivalents.

The existing code tries to call `self.index(arg)` by in fact just calling `std::ops::index(self, arg)` which may itself be a bit wrong... I'm not sure how it should work mechanically.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the static-array indexing work from #424 and the existing implementation that calls self.index(arg) through std::ops::index. Determine how Rust-like Index and possibly IndexMut traits should work mechanically, then verify that indexing is supported for the intended non-static-array types.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.