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

Add String.compare #1147

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

PureFox48
Copy link
Contributor

The purpose of this PR is to enable comparisons between strings as discussed in #1142.

This will be particularly useful when sorting a list of strings.

The String.compareTo instance method is implemented in C for maximum speed and the comparison operators <, <=, >, >=, which call it under the hood, are implemented in Wren.

Tests and documentation are included in the PR.

@mhermier
Copy link
Contributor

mhermier commented Mar 4, 2023

Implementation is good enough, thought the style is not really my taste.
We could squeeze a little bit more efficiency by making operators primitives, but that can wait till we can prove to be a bottleneck.

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.

None yet

2 participants