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

Bytes #23

Merged
merged 12 commits into from
Nov 28, 2024
Merged

Bytes #23

merged 12 commits into from
Nov 28, 2024

Conversation

HSMF
Copy link
Contributor

@HSMF HSMF commented Nov 28, 2024

Introduce a bytes package that mirrors go's bytes package. Currently supported functions are Split and Repeat.

Furthermore, a function View in byteslice is added to map []byte -> seq[byte].

For Split, we require the separator to be non-empty. The Go implementation handles this case by returning a string split at every utf8 codepoint boundary: Split("abc☺", "") -> "a", "b", "c", "☺"
Do we want to mimic this behavior?

byteslice/byteslice.gobra Outdated Show resolved Hide resolved
byteslice/byteslice.gobra Outdated Show resolved Hide resolved
bytes/bytes_test.gobra Outdated Show resolved Hide resolved
bytes/bytes.gobra Outdated Show resolved Hide resolved
bytes/bytes.gobra Show resolved Hide resolved
bytes/bytes.gobra Outdated Show resolved Hide resolved
bytes/bytes.gobra Outdated Show resolved Hide resolved
Copy link
Collaborator

@jcp19 jcp19 left a comment

Choose a reason for hiding this comment

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

after my comments are incorporated, we can merge it. To answer your question, I would keep the precondition that the separator is not empty

bytes/bytes.gobra Show resolved Hide resolved
byteslice/byteslice.gobra Outdated Show resolved Hide resolved
byteslice/byteslice.gobra Outdated Show resolved Hide resolved
bytes/bytes.gobra Show resolved Hide resolved
@HSMF
Copy link
Contributor Author

HSMF commented Nov 28, 2024

I think this is ready to be merged now

@jcp19 jcp19 merged commit 9816da7 into viperproject:main Nov 28, 2024
1 check passed
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