Is there a reason why tuples, structures, and tuples should have inconsistent syntax in Rust?

Is there a reason why tuples, structures, and tuples should have inconsistent syntax in Rust?

I'm still reading the manual, so there might be an obvious answer to this question, but couldn't the syntax be unified so that all of the following are legal ?:

struct {Int,Int}
struct Foo{Int,Int}
struct {a:Int,b:Int}
struct Foo{a:int,b:Int}
struct Foo{Int,a:Int,b:Int,Int}

      

If there is some technical reason to avoid mixing named and unnamed parameters, you can store unnamed parameters in parameters () and named parameters in {} ...

struct (Int,Int)
struct Foo(Int,Int)
struct {a:Int,b:Int}
struct Foo{a:Int,b:Int}
struct Foo(Int,Int){a:Int,b:Int}

      

+3


source to share


1 answer


No, but none of the alternative suggestions seemed to be worth breaking all of the existing code.



https://internals.rust-lang.org/t/unify-structs-tuples-and-funciton-calls/1667

+2


source







All Articles