8000 deprecate tiny wrappers by bobzhang · Pull Request #2376 · moonbitlang/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

deprecate tiny wrappers #2376

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

Merged
merged 1 commit into from
Jun 28, 2025
Merged

deprecate tiny wrappers #2376

merged 1 commit into from
Jun 28, 2025

Conversation

bobzhang
Copy link
Contributor

No description provided.

Copy link
Missing reference to deprecated `some` function in test

Category
Correctness
Code Snippet
test "some equals to Some" {
let x : Int? = Some(5)
let y : Int? = some(5)
assert_eq(x, y)
}
Recommendation
Either remove this test since some is deprecated, or move it to deprecated.mbt file with appropriate imports. The test name should also be updated to reflect its purpose.
Reasoning
The test references the deprecated some function but doesn't import it from the deprecated module, which could cause compilation errors.

Inconsistent deprecation message formatting

Category
Maintainability
Code Snippet
#deprecated("inline instead for such tiny function")
Recommendation
Use consistent deprecation messages across all functions, such as "Use inline constructors instead" or provide migration examples for each function.
Reasoning
All deprecated functions use identical deprecation messages, but they could be more specific about what to use instead (e.g., 'Use Some(value) instead of some(value)').

Documentation inconsistency after deprecation

Category
Maintainability
Code Snippet
test "some equals to Some" {
let x : Int? = Some(5)
let y : Int? = some(5)
assert_eq(x, y)
}
Recommendation
Remove or update the test to focus on the non-deprecated API. Consider adding a comment explaining the deprecation if the test must remain for backward compatibility testing.
Reasoning
Keeping tests for deprecated functions in the main module creates confusion about which API patterns are recommended for new code.

@bobzhang bobzhang requested a review from Copilot June 28, 2025 10:36
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

The purpose of this PR is to deprecate tiny wrapper functions used for Option handling in favor of inline expressions. Key changes include:

  • Marking functions (empty, some, unless, when) as deprecated in option/option.mbti.
  • Removing the implementations and tests for these functions from option/option.mbt.
  • Introducing a dedicated file (option/deprecated.mbt) that provides deprecated implementations with clear deprecation messages.
  • Updating documentation in option/README.mbt.md to reflect these changes.

Reviewed Changes

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

File Description
option/option.mbti Added deprecation annotations to tiny wrapper functions
option/option.mbt Removed function implementations and updated tests
option/deprecated.mbt Introduced deprecated implementations with deprecation messages
option/README.mbt.md Updated documentation to reflect the deprecation of tiny wrappers
Comments suppressed due to low confidence (1)

option/option.mbti:8

  • Consider adding a deprecation message to the '#deprecated' annotation for clarity, e.g., '#deprecated("inline instead for such tiny function")', to make the code change self-explanatory.
#deprecated

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 134

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 89.361%

Totals Coverage Status
Change from base Build 132: 0.0%
Covered Lines: 3452
Relevant Lines: 3863

💛 - Coveralls

@bobzhang bobzhang enabled auto-merge (rebase) June 28, 2025 10:38
@bobzhang bobzhang merged commit d7c13dc into main Jun 28, 2025
10 checks passed
@bobzhang bobzhang deleted the hongbo/align_rust_option branch June 28, 2025 10:40
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.

2 participants
0