You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/0073-stricter-connections.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,8 +39,8 @@ Currently, `lib.data.View.eq()` does no checks on the passed value and immediate
39
39
(eq (sig a) (sig b))
40
40
```
41
41
42
-
This RFC proposes adding a check to `View.eq()` that would reject direct assignments from another `View` with a non-identical layout.
43
-
If such an assignment is desired, the other `View` can be explicitly passed through `Value.cast()` first.
42
+
This RFC proposes adding a check to `View.eq()` that would reject direct assignments from another aggregate data structure with a non-identical layout.
43
+
If such an assignment is desired, the other aggregate data structure can be explicitly passed through `Value.cast()` first.
44
44
45
45
Currently `lib.wiring.connect()` passes every signal through `Value.cast()` before assigning them.
46
46
This results in a `ValueCastable`'s `.eq()` not being called, and thereby bypassing the check proposed above.
@@ -51,8 +51,9 @@ This RFC proposes removing the `Value.cast()` so a `ValueCastable`'s `.eq()` wil
Modify `lib.data.View.eq(other)` to add the following checks:
54
-
- If `other` is a `View`, reject the assignment if layouts are not identical.
55
-
- Otherwise, if `other` is another `ValueCastable`, reject the assignment.
54
+
- If `other` is a `ValueCastable`, do `Layout.cast(other.shape())`
55
+
- If a valid `Layout` is returned, reject the assignment if it doesn't match `self.shape()`.
56
+
- If `Layout.cast()` raises, reject the assignment.
56
57
- Otherwise, proceed as normal.
57
58
58
59
Modify `lib.wiring.connect()` to not pass port members through `Value.cast()`, so that a `ValueCastable`'s `.eq()` will be called, allowing it to perform compatibility checks.
0 commit comments