Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

josetorrs
Copy link

addresses #5373

Implementing lt, le, gt, ge for Codepoint

Copy link

github-actions bot commented Oct 16, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@josetorrs
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@josetorrs
Copy link
Author

recheck

modular-cla-bot bot added a commit to modular/cla that referenced this pull request Oct 16, 2025
@josetorrs josetorrs marked this pull request as ready for review October 16, 2025 22:27
@josetorrs josetorrs requested a review from a team as a code owner October 16, 2025 22:27
@JoeLoser JoeLoser requested a review from Copilot October 16, 2025 22:32
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds rich comparison dunder methods (lt, le, gt, ge) to Codepoint and extends tests to exercise comparison behavior.

  • Implements four new comparison methods delegating to underlying u32 value.
  • Adds unit tests invoking the new methods directly.
  • Updates documentation via new docstrings for each method.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
mojo/stdlib/stdlib/collections/string/codepoint.mojo Adds comparison operator methods with accompanying docstrings.
mojo/stdlib/test/collections/test_codepoint.mojo Adds tests for the new comparison functionality using direct dunder invocation.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

mojo/stdlib/stdlib/collections/string/codepoint.mojo Outdated Show resolved Hide resolved
mojo/stdlib/stdlib/collections/string/codepoint.mojo Outdated Show resolved Hide resolved
Args:
other: The codepoint value to compare against.
Returns:
True if this character's values is greater than or equal the other codepoint values;
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

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

Grammar: missing 'to' after 'equal', and plural/singular mismatch; suggested: 'True if this character's value is greater than or equal to the other codepoint value;'.

Suggested change
True if this character's values is greater than or equal the other codepoint values;
True if this character's value is greater than or equal to the other codepoint value;

Copilot uses AI. Check for mistakes.

Positive FeedbackNegative Feedback
mojo/stdlib/stdlib/collections/string/codepoint.mojo Outdated Show resolved Hide resolved
@soraros
Copy link
Contributor

soraros commented Oct 16, 2025

We can/should now put Comparable conformance on the type.

@josetorrs
Copy link
Author

We can/should now put Comparable conformance on the type.

updated here: 86c0f1d

Copy link
Collaborator

@JoeLoser JoeLoser left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! And welcome to Mojo 🔥

I've approved the PR and I'll sync it in shortly. Before doing so, do you mind also adding a changelog entry here please so others know about your new enhancement? Thanks!

fn __lt__(self, other: Self) -> Bool:
"""Return True if this character is less than a different codepoint value from
`other`.
Args:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we usually leave newlines between these sections, please follow other docstring in the same file.

Copy link
Author

Choose a reason for hiding this comment

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

added here: 7fb0311

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.

[Feature Request] Codepoint should implement __lt__, __le__, __gt__, __ge__

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.