Skip to content

Conversation

@HertzDevil
Copy link
Contributor

The single-index overload in the macro language has always behaved like #[]? in non-macro code, so I don't think there is any particular benefit in making both the range overload and the start + count overload both raise on out-of-bounds start indices.

This actually applies to TupleLiteral as well.

@straight-shoota
Copy link
Member

Sorry, this PR slipped through my review list.

The proposal sounds good. I suppose the rule of thumb is that methods in macro land should generally behave similar to the equivalents in Ruby.
Like Ruby, there is no static typing.

Even more, in macro land we couldn't even rescue an exception. So raising is not very useful except for really unrecoverable errors. It aborts the entire compilation. Returning NilLiteral has the same effect as raising when the calling code does not expect it.

@straight-shoota straight-shoota added this to the 1.19.0 milestone Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants