Skip to content

Commit

Permalink
RFC #73: Final touches.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyp committed Sep 16, 2024
1 parent d660bfc commit 6e0d5a6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions text/0073-stricter-connections.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- Start Date: (fill in with date at which the RFC is merged, YYYY-MM-DD)
- Start Date: 2024-09-16
- RFC PR: [amaranth-lang/rfcs#73](https://github.com/amaranth-lang/rfcs/pull/73)
- Amaranth Issue: [amaranth-lang/amaranth#0000](https://github.com/amaranth-lang/amaranth/issues/0000)
- Amaranth Issue: [amaranth-lang/amaranth#1511](https://github.com/amaranth-lang/amaranth/issues/1511)

# Stricter connections

Expand Down Expand Up @@ -62,15 +62,16 @@ Modify `lib.data.View.eq(other)` to add the following checks:
- Otherwise, proceed as normal.

Modify `lib.enum.EnumView.eq(other)` to add the following checks:
- If `other` is an `EnumView`, reject the assignment if enum types are not identical.
- Otherwise, if `other` is another `ValueCastable`, reject the assignment.
- If `other` is a `ValueCastable`, reject the assignment if `other.shape()` doesn't match `self.shape()`.
- Otherwise, proceed as normal.

Rejected assignments are a warning in Amaranth 0.6 and becomes a hard error in Amaranth 0.7.

## Drawbacks
[drawbacks]: #drawbacks

- Increased language complexity.

- This will add an implied requirement for a `ValueCastable` to implement `.eq()` to be usable with `lib.wiring`. Currently a `ValueCastable` is not required to implement `.eq()` at all.
- We could fall back to `Value.cast().eq()` when `.eq()` is not defined.

Expand All @@ -91,7 +92,7 @@ Rejected assignments are a warning in Amaranth 0.6 and becomes a hard error in A
## Unresolved questions
[unresolved-questions]: #unresolved-questions

None (yet).
None.

## Future possibilities
[future-possibilities]: #future-possibilities
Expand Down

0 comments on commit 6e0d5a6

Please sign in to comment.