mojo icon indicating copy to clipboard operation
mojo copied to clipboard

[Proposal] Standardise the representation of byte sequence as a sequence of unsigned 8 bit integers

Open mzaks opened this issue 3 months ago • 2 comments

See the byte-as-uint8.md file

mzaks avatar Mar 31 '24 10:03 mzaks

Thanks so much for going through the proposal process! We as a team really appreciate the thought and motivation presented, and are happy to accept this proposal! 🎉 🎉 🎉

Internally, we went back and forth whether to add an alias Byte = UInt8 and don't feel strongly either way when the technical implementation for this proposal happens. Also, to be explicit about our existing commitments and priorities — we'd love if the community is interested in changing the Int8 to UInt8 in the open-source parts of the standard library, and we're happy to do the rest for the closed source modules when we import said PR. Otherwise, this isn't on our immediate radar given pre-existing internal commitments.

Regarding the alias part, since an alias is a weak type, it's only for readability sake/to denote we're conceptually working with "bytes" since you can't overload functions/APIs on weak types, and we don't yet have a strong Bytes type (and there's no need to couple this proposal with https://github.com/modularml/mojo/pull/2096 for example).

Congrats again on the first standard library proposal to be accepted! Now that we have a process internally for discussing these, we expect to be able to triage and discuss these in a much more timely fashion going forward. Thanks for your patience with this one.

JoeLoser avatar Apr 17 '24 01:04 JoeLoser

I made #2317 to track the progress of the implementation

gabrieldemarmiesse avatar Apr 17 '24 14:04 gabrieldemarmiesse

Hm, why is the first commit not verified? @JoeLoser do you have an idea?

mzaks avatar Apr 18 '24 15:04 mzaks

Hm, why is the first commit not verified? @JoeLoser do you have an idea?

Looks like one was signed with your GPG key and one was not. The GPG signing isn't required, so I went ahead and merged this. We only require a sign-off using git commit -s to sign your commits (which is different than verifying your commits). In any case, the final squashed and merged commit as seen here shows it as GPG-verified, so that's good if that's what you were wanting. 😄

JoeLoser avatar Apr 18 '24 15:04 JoeLoser

FYI I realized this was targeting the main branch and not nightly, but snuck in since it wasn't rebased where we have CI checking it targets the nightly branch. I'm happy to open a PR for this to target the nightly branch as well later today unless you beat me to it.

The main branch will automatically get synced each time we make a new MAX release and it'll pick up all the things in the nightly branch effectively that made it into the stable MAX release.

JoeLoser avatar Apr 18 '24 19:04 JoeLoser