noir icon indicating copy to clipboard operation
noir copied to clipboard

Trait aliases

Open michaeljklein opened this issue 4 months ago • 0 comments

Problem

Trait inheritance allows traits to require other traits, but explicitly including all required traits in functions or impl's can become repetitive.

Happy Case

Once https://github.com/noir-lang/noir/issues/6314 is fixed, support some version of trait aliases, e.g., by desugaring a trait alias declaration:

trait Baz = Foo + Bar;

into (approximately):

trait Baz: Foo + Bar {}

impl<T> Baz for T where T: Foo + Bar {}

Either support something similar to this experimental Rust feature or else ensure that it can be implemented with a simple Noir macro.

Workaround

Yes

Workaround Description

trait Baz: Foo + Bar {} can currently be defined, but currently needs an explicit impl Baz for MyStruct for each type

Additional Context

No response

Project Impact

None

Blocker Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

michaeljklein avatar Oct 22 '24 17:10 michaeljklein