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 carry/borrow to Fallible<MutableDataInt.Body> #148

Open
oscbyspro opened this issue Dec 13, 2024 · 1 comment
Open

Add carry/borrow to Fallible<MutableDataInt.Body> #148

oscbyspro opened this issue Dec 13, 2024 · 1 comment
Labels
addition oh, so shiny! brrr such code, much wow maybe to do, or not to do? subtraction huh? where did it go?

Comments

@oscbyspro
Copy link
Owner

oscbyspro commented Dec 13, 2024

The MutableDataInt<Element>.Body model has many operation pairs similar to this:

extension MutableDataInt.Body {
    consuming func increment(..............) -> Fallible<Self>
    consuming func incrementSubSequence(...) -> Fallible<Self>
}

The *SubSequence operations represent some core algorithm that stops at the end of the given arguments. The non-*SubSequence carries or borrows the error indicator after that point. What if I instead add a carry() and borrow() to Fallible<MutableDataInt.Body>? I believe those two methods would make every non-*SubSequence variant obsolete.

@oscbyspro oscbyspro added addition oh, so shiny! brrr such code, much wow maybe to do, or not to do? subtraction huh? where did it go? labels Dec 13, 2024
@oscbyspro
Copy link
Owner Author

oscbyspro commented Dec 14, 2024

Alternatively, I could have special return types that continue() by carrying or borrowing. Is that too complex? I'll have to think about it some more before I commit to any particular solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition oh, so shiny! brrr such code, much wow maybe to do, or not to do? subtraction huh? where did it go?
Projects
None yet
Development

No branches or pull requests

1 participant