Skip to content

[SE-0525] remove default parameters from load and storeBytes#3260

Open
glessard wants to merge 28 commits intoswiftlang:mainfrom
glessard:rawspan-safe-loading-updates
Open

[SE-0525] remove default parameters from load and storeBytes#3260
glessard wants to merge 28 commits intoswiftlang:mainfrom
glessard:rawspan-safe-loading-updates

Conversation

@glessard
Copy link
Copy Markdown
Contributor

@glessard glessard commented Apr 22, 2026

  • Remove default parameters, from load and storeBytes functions, as discussed in the LSG proposal acceptance meeting.

  • Add an “alternatives considered” paragraph to document this.

  • Added a missing "Implications on adoption" section.

  • Fixed many inconsistencies in doc-comments and between sections.

  • Had erroneously proposed @unsafe attribute on conformances, instead of @unchecked.

  • Had erroneously proposed an argument label of MutableSpan.init(bytes: MutableRawSpan) instead MutableSpan.init(mutableBytes: MutableRawSpan).

  • The first argument label of OutputSpan.append(elements: Int, initializingWith: (OutputRawSpan) -> R) is changed to elementCount for clarity.

- Add an “alternatives considered” paragraph
@glessard glessard requested a review from xwu April 22, 2026 20:34
@glessard glessard force-pushed the rawspan-safe-loading-updates branch from 13c5d27 to 5d75c47 Compare April 24, 2026 05:36
Copy link
Copy Markdown
Contributor

@xwu xwu left a comment

Choose a reason for hiding this comment

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

Nice clean-ups!

I discussed the API-level bugfixes with the group. They pointed out that we have slightly different spellings for append(elementCount:...) here versus append(addingCount:...) for the in-flight UniqueArray and RigidArray that should probably be reconciled, so I'll merge with acceptance and prompt the community for a focused mini-review on the API bugfixes (the remaining ones being pretty uncontroversial).

subscript(unchecked byteOffset: Int) -> UInt8 { get set }

/// The offsets valid for subscripting the span, in ascending order.
public var byteOffsets: Range<Int>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this always 0..<byteCount?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. RawSpan and MutableRawSpan already had this property, so this was a gap.

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