Skip to content

Comments

New RFC spark-constant-in-iterator#201

Open
tonunaks wants to merge 1 commit intomasterfrom
mr/constant-in-iterator
Open

New RFC spark-constant-in-iterator#201
tonunaks wants to merge 1 commit intomasterfrom
mr/constant-in-iterator

Conversation

@tonunaks
Copy link
Collaborator

@tonunaks tonunaks requested a review from clairedross February 12, 2026 13:18
@tonunaks tonunaks linked an issue Feb 12, 2026 that may be closed by this pull request
because, despite of being safer, wouldn't solve the original problem outlined
of the summary of this RFC.

Another possible enhancement would be allowing private functions in the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify what you mean by a "private function", perhaps with an example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nikokrock, do you have an example for this? You mentioned that this has been discussed earlier.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type Bytes is private
   with Iterable => (First       => First,
                     Next        => Next,
                     Has_Element => Has_Element,
                     Element     => Unsafe_Get);

If you want to have an efficient implementation, it's better to provide a Get_Element that does not checks bounds has this check is already done by Has_Element. Would be great to make in that case Unsafe_Get private (and so only usable through the iterator)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understand what you mean by "bounds". Note that Get_Element might have a precondition (not executed in production) and not necessarily defensive coding.

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.

[feature] Use Constant_Reference instead of Element in Iterable

4 participants