Skip to content

prelude: Array#[] out-of-range returns nil; Array.new block/default - #95

Open
Dahrkael wants to merge 1 commit into
mrubyedge:masterfrom
Dahrkael:pr/1bc-array-fixes
Open

Dahrkael wants to merge 1 commit into
mrubyedge:masterfrom
Dahrkael:pr/1bc-array-fixes

Conversation

@Dahrkael

Copy link
Copy Markdown
Contributor

Array#[] indexed the Vec directly and panicked for out-of-range and negative-out-of-range indices; it now returns nil and rejects a missing index. Array.new ignored a block and only filled with nil; it now supports Array.new(size) { |i| ... } and Array.new(size, default). Adds tests.

`Array#[]` indexed the Vec directly and panicked for out-of-range and negative-out-of-range indices; it now returns nil (as in CRuby) and rejects a missing index. `Array.new` ignored a block and only filled with nil; it now supports `Array.new(size) { |i| ... }` and `Array.new(size, default)`. Adds tests.
@udzura udzura self-assigned this Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants