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

[Feature Request] Use unsigned bytes for String's buffer #420

Open
1 task done
lsh opened this issue Jul 1, 2023 · 2 comments
Open
1 task done

[Feature Request] Use unsigned bytes for String's buffer #420

lsh opened this issue Jul 1, 2023 · 2 comments
Labels
enhancement New feature or request mojo Issues that are related to mojo mojo-repo Tag all issues with this label mojo-stdlib Tag for issues related to standard library

Comments

@lsh
Copy link
Contributor

lsh commented Jul 1, 2023

Review Mojo's priorities

What is your request?

Right now, String's data is stored as DynamicVector[Int8], but it should likely be DynamicVector[UInt8].

What is your motivation for this change?

Signed bytes tend to make users think semantically that they are working with numbers rather than raw data. It's also become increasingly popular to describe raw bytes as just a Vector of unsigned bytes (such as Uint8Array in JavaScript or []const u8 in Zig).

@lsh lsh added the enhancement New feature or request label Jul 1, 2023
@abduld
Copy link
Contributor

abduld commented Jul 1, 2023

Makes sense, although users should not be working directly with the bytes within a string :) Also, we try to match C semantics here which uses char * for strings

btw. there is a plan to perform optimizations on strings (e.g. small string optimizations), so you should never depend on its layout

@abduld abduld self-assigned this Jul 1, 2023
@lattner
Copy link
Collaborator

lattner commented Jul 1, 2023

+1, the current implementation needs to be improved a bunch.

@Mogball Mogball added the mojo-stdlib Tag for issues related to standard library label Sep 6, 2023
@ematejska ematejska added the mojo Issues that are related to mojo label Sep 7, 2023
@ematejska ematejska added the mojo-repo Tag all issues with this label label Apr 29, 2024
@JoeLoser JoeLoser assigned JoeLoser and unassigned JoeLoser May 3, 2024
@ematejska ematejska removed the mojo-stdlib Tag for issues related to standard library label May 3, 2024
@ematejska ematejska added the mojo-stdlib Tag for issues related to standard library label May 3, 2024 — with Linear
@ematejska ematejska removed the mojo-stdlib Tag for issues related to standard library label May 6, 2024
@ematejska ematejska added the mojo-stdlib Tag for issues related to standard library label May 6, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mojo Issues that are related to mojo mojo-repo Tag all issues with this label mojo-stdlib Tag for issues related to standard library
Projects
None yet
Development

No branches or pull requests

6 participants