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

feat(builtin)!: rename map_option to filter_map #1335

Merged
merged 3 commits into from
Dec 25, 2024

Conversation

rami3l
Copy link
Contributor

@rami3l rami3l commented Dec 17, 2024

Continuation of #1154; mirrors OCaml's List.filter_map.

@coveralls
Copy link
Collaborator

coveralls commented Dec 17, 2024

Pull Request Test Coverage Report for Build 4323

Details

  • 0 of 2 (0.0%) changed or added relevant lines in 2 files are covered.
  • 20 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.4%) to 83.012%

Changes Missing Coverage Covered Lines Changed/Added Lines %
array/array.mbt 0 1 0.0%
builtin/iter.mbt 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
immut/array/operation.mbt 1 66.67%
immut/array/tree.mbt 9 52.0%
immut/array/array.mbt 10 86.08%
Totals Coverage Status
Change from base Build 4321: -0.4%
Covered Lines: 4603
Relevant Lines: 5545

💛 - Coveralls

@rami3l rami3l requested a review from bobzhang December 23, 2024 10:12
Copy link

‼️ This code review is generated by a bot. Please verify the content before trusting it.

Here are three observations from the provided git diff output:

  1. Deprecation of map_option in favor of filter_map:

    • The function map_option has been renamed to filter_map in both the Array and Iter implementations. This is a good change for clarity, as filter_map better describes the functionality (filtering and mapping in one operation). However, the deprecated map_option function is still retained for backward compatibility, which is a good practice. Ensure that all documentation and usage in the codebase are updated to reflect this change.
  2. Inconsistent Deprecation Notices:

    • The deprecation notice for map_option in array.mbt uses @alert deprecated "Use Array::filter_map instead", while in iter.mbt, it uses @alert deprecated "Use Iter::filter_map instead". This inconsistency in the deprecation message could confuse users. It would be better to standardize the deprecation message format across the codebase.
  3. Test Case Updates:

    • The test cases in array_test.mbt and iter_test.mbt have been updated to use filter_map instead of map_option. This is a necessary change to align with the renaming. However, ensure that all test cases are thoroughly reviewed to confirm that no functionality is inadvertently broken during this transition. For example, verify that edge cases (e.g., empty arrays, None returns from the mapping function) are still correctly handled.

These changes are generally positive, but attention to detail in documentation, deprecation notices, and test coverage is crucial to maintain code quality and user experience.

@bobzhang bobzhang enabled auto-merge (rebase) December 25, 2024 14:12
@bobzhang bobzhang merged commit 550f2a1 into moonbitlang:main Dec 25, 2024
13 checks passed
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.

4 participants