Skip to content

🏗️ [Core Feature]: use nightly feature for mutual exclusivity #560

@ozgunozerk

Description

@ozgunozerk

What is the key feature we're aiming to implement?

Right now, we are utilizing associated types and unit structs to enable mutual exclusivity.

Although this approach works, here is the problem with it:

  • say, extensions A and B are incompatible
  • say, C and D are incompatible

With our current approach, the following is impossible

  • a contract with A and C
  • this is due to, to enforce mutual exclusivity, we generate concrete types, say A, B, C, and D
  • that's why, if it is A, it cannot be B. But similarly, if it is A, it cannot be C and D either...

We have an alternative solution to this, by utilizing combinatorics, we can have the following:

  • AandC
  • AandD
  • BandC
  • BandD

all these will be implementation details, that the end developer won't see and use at all. All the complexity will be hidden, hence, not a bad solution.

However, we found out a nightly feature, that enables us to enforce negative trait bounds directly, without any workarounds with positive bounds.

This feature alone, may be an enough reason to switch to nightly channel

Metadata

Metadata

Assignees

Labels

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions