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

Trait sugar syntax for maker trait and implementing the same maker trait for multiple type #3732

Open
Thomas-Mewily opened this issue Nov 26, 2024 · 1 comment

Comments

@Thomas-Mewily
Copy link

Thomas-Mewily commented Nov 26, 2024

Hello there, here is just a personal suggestion to keep the consistency between declaring a empty struct / marker trait, nothings really important but anyway ^^

struct Empty;   // ok
struct Empty {} // ok

trait SignedInteger;   // currently not ok 
trait SignedInteger {} // ok

impl SignedInteger for i8;   // currently not ok
impl SignedInteger for i8 {} // ok

Also, sometime implementing the same maker trait for multiples types can be helpful (instead of using macro) :

impl SignedInteger for i8, i16, i32, i64, isize;   // currently not ok
impl SignedInteger for i8, i16, i32, i64, isize {} // currently not ok
@kennytm
Copy link
Member

kennytm commented Nov 26, 2024

consistency between declaring a empty struct / marker trait

struct Empty; and struct Empty {} are not equivalent. The former also allows you to create an instance like let x = Empty; which is not possible for the latter.

So there is no "consistency", and it is not an applicable rationale here.

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

No branches or pull requests

2 participants