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

dev: be coherent about math trait taking a snap or the value itself #5694

Open
tdelabro opened this issue May 31, 2024 · 0 comments
Open

dev: be coherent about math trait taking a snap or the value itself #5694

tdelabro opened this issue May 31, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@tdelabro
Copy link
Contributor

tdelabro commented May 31, 2024

Here is PartialEq trait definition:
https://github.com/starkware-libs/cairo/blob/main/corelib/src/traits.cairo#L55-L60

For some reason, the methods of this trait take their arg as snapshot, while all other trait takes them as value:

Is there a reason for this special treatment?
We should be coherent across the core lib so I suggest changing the trait definition to

pub trait PartialEq<T> {
    fn eq(lhs: T, rhs: T) -> bool;
    fn ne(lhs: T, rhs: T) -> bool {
        !Self::eq(lhs, rhs)
    }
}

I don't know what it implies in terms of breaking changes. Maybe those can be mitigated from a dev perspective by the use of implicit deref...

@tdelabro tdelabro added the enhancement New feature or request label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant