Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stdlib): Add Bytes.setChar and Bytes.getChar #2215

Merged
merged 9 commits into from
Jan 2, 2025

Conversation

spotandjake
Copy link
Member

This pr was originally only meant to add Bytes.setChar and Bytes.getChar but I wanted it to share the utf8 impl with the string library, One thing led to another and I added a new Utf8 library into the runtime.

The Utf8 module houses all of the shared low level utf8 logic for encoding and decoding I also refactored the runtime and stdlib to make use of these sharedHelpers which removed a lot of duplicate code and I think should be enough to close out #684

As this pr got a little off track I am happy to make this pr just a refactor and move the setChar and getChar changes to a separate pr. A small note on the function themselves, compared to the other set and get methods chars are slightly different as we need to account for the range of byte sizes this is going to make Buffer.setChar slightly more annoying when I get around to that.

Copy link
Member

@ospencer ospencer left a comment

Choose a reason for hiding this comment

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

Overall looks great!

stdlib/runtime/utf8.gr Outdated Show resolved Hide resolved
stdlib/runtime/utf8.gr Outdated Show resolved Hide resolved
stdlib/runtime/utf8.gr Outdated Show resolved Hide resolved
stdlib/runtime/utf8.gr Outdated Show resolved Hide resolved
stdlib/runtime/utf8.gr Outdated Show resolved Hide resolved
stdlib/runtime/utf8.gr Outdated Show resolved Hide resolved
stdlib/bytes.gr Outdated Show resolved Hide resolved
stdlib/bytes.gr Outdated Show resolved Hide resolved
stdlib/bytes.gr Outdated Show resolved Hide resolved
stdlib/bytes.gr Outdated Show resolved Hide resolved
@ospencer ospencer changed the title feat(stdlib): Add Bytes.setChar and Bytes.getChar, along with utf8 refactors. feat(stdlib): Add Bytes.setChar and Bytes.getChar Jan 2, 2025
@ospencer ospencer added this pull request to the merge queue Jan 2, 2025
Merged via the queue into grain-lang:main with commit 4919ba3 Jan 2, 2025
12 checks passed
@github-actions github-actions bot mentioned this pull request Dec 29, 2024
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