fix: avoid breaking change#2
Open
peter-jerry-ye wants to merge 2 commits into
Open
Conversation
chawyehsu
reviewed
May 14, 2026
| let mut m = @uint.max_value | ||
| for j = 0U; j < input_lenght; j = j + 1U { | ||
| let code = raw[j.reinterpret_as_int()].reinterpret_as_uint() | ||
| let code = raw[j.reinterpret_as_int()].to_uint() |
Owner
There was a problem hiding this comment.
@peter-jerry-ye Hi, I haven't been following moonbit's evolution closely, but I've been paying attention to the release notes from time to time. The last time I received a similar change, to_uint was a method that was replaced by reinterpret_as_uint and marked as obsolete1. However, the change you proposed is the complete opposite, which I don't understand. Could please you elaborate on this?
Footnotes
Author
|
Hi
It’s due to API change. If I recall correctly, String used to return Int for index access. At that time Int::to_uint was changed to Int::reinterpret_as_uint. But later, String access returns UInt16 to make it clear that it’s char code, thus it should now be UInt16::to_uint. With that said, the PR was created long ago. Other things may have also changed.
在 2026年5月14日,12:07,Chawye Hsu ***@***.***> 写道:
@chawyehsu commented on this pull request.
________________________________
In encode.mbt<#2 (comment)>:
@@ -18,7 +19,7 @@ pub fn encode(raw : String) -> String? {
// let m = the minimum {non-basic} code point >= n in the input
let mut m = @uint.max_value
for j = 0U; j < input_lenght; j = j + 1U {
- let code = raw[j.reinterpret_as_int()].reinterpret_as_uint()
+ let code = raw[j.reinterpret_as_int()].to_uint()
@peter-jerry-ye<https://github.com/peter-jerry-ye> Hi, I haven't been following moonbit's evolution closely, but I've been paying attention to the release notes from time to time. The last time I received a similar change, to_uint was a method that was replaced by reinterpret_as_uint and marked as obsolete1. However, the change you proposed is the complete opposite, which I don't understand. Could please you elaborate on this?
Footnotes
1. #1 ↩
—
Reply to this email directly, view it on GitHub<#2 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AD7U6XN6VPHG3CKZMBVSUWD42VA7VAVCNFSM6AAAAACY5NJE5WVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHM2DEOBXGE3TOOBVGE>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.