[PROPOSAL] Iterator Improvements (Step, Reverse, Float)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
Research direction
The issue names no files, tests, or entry points. Start by reviewing existing iterator behavior and the compiler's “Cannot iterate backwards” diagnostic; the proposal still needs settled semantics for reverse, step, and float iteration before implementation can begin.
Written by the indexing model from the issue text.
Description
I'd like to see more functionality for iterators, inspired by Ruby.
// Standard IntIterator
for (i in (0...10))
trace(i); // 1, 2, 3, 4, 5...
// PROPOSALS
// Reverse Iterator
for (i in (10...0))
trace(i); // 10, 9, 8, 7, 6
// Step Iterator
for (i in (0...10).step(2))
trace(i); // 0, 2, 4, 6, 8
// FloatIterator with Step
// Compiler type-checks min and max to determine if it is an Int or a Float before choosing an iterator.
for (i in (5.0...7.5).step(0.1))
trace(i); // 5.0, 5.1, 5.2, 5.3, 5.4, ...
I was actually able to implement step(value:Int):IntIterator locally without modifying compilation, but reverse and FloatIterator would require compiler changes (I got a "Cannot iterate backwards" error)
This is pre-draft, but if nobody has any obvious problems with it I will write up a more formal proposal
- Dominant language
- No language data
- Stars
- 120
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from HaxeFoundation/haxe-evolution
-
Difficulty 1/5 Under an hour Newbie friendliness 5/100
HaxeFoundation/haxe-evolution#126 · 2 comments · 1 reaction ·
-
License for RFCsOpen
Difficulty 5/5 Over a week Newbie friendliness 35/100
HaxeFoundation/haxe-evolution#121 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
HaxeFoundation/haxe-evolution#120 · 9 comments · 5 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
HaxeFoundation/haxe-evolution#114 · 8 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
HaxeFoundation/haxe-evolution#107 · 1 comment · 1 reaction ·
All issues in HaxeFoundation/haxe-evolution
Similar issues
-
clang:frontend clang:openmp crash
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
llvm/llvm-project#245442 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
module: exir
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
pytorch/executorch#25620 ·
Maintainers usually reply within 1 day
-
node:url: url.parse and url.resolve report name parse/resolve instead of Node's urlParse/urlResolveOpenarea:stdlib effort:S impact:low parity type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
rust-lang/miri#5673 · 3 comments ·
Maintainers usually reply within 1 day