Skip to content

Commit 1727fae

Browse files
committed
Merge RFC #34: Rename amaranth.lib.wiring.Interface to PureInterface
2 parents 465d188 + 86436c1 commit 1727fae

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

text/0034-interface-rename.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
- Start Date: 2023-12-04
2+
- RFC PR: [amaranth-lang/rfcs#34](https://github.com/amaranth-lang/rfcs/pull/34)
3+
- Amaranth Issue: [amaranth-lang/amaranth#985](https://github.com/amaranth-lang/amaranth/issues/985)
4+
5+
# Rename `amaranth.lib.wiring.Interface` to `PureInterface`
6+
7+
## Summary
8+
[summary]: #summary
9+
10+
The `Interface` class in `amaranth.lib.wiring` is renamed to `PureInterface`, to avoid the impression that it is used for *all* interfaces.
11+
12+
## Motivation
13+
[motivation]: #motivation
14+
15+
The current naming of the `Interface` class wrongly suggests that it is the base class to be used for all interfaces, and that `isinstance(foo, Interface)` is a valid check for an interface. However, this is in stark contrast to how `lib.wiring` works: any object can be an interface, as long as it has a `signature` property and compliant members. This misleads users (and, on at least two occasions, amaranth developers), making them write buggy code.
16+
17+
Additionally, the naming makes spoken language ambiguous in a bad way, as it is impossible to tell apart "an interface" and "an Interface".
18+
19+
Therefore, this RFC proposes to rename `Interface` to something more specific and reflecting its function.
20+
21+
## Guide-level explanation
22+
[guide-level-explanation]: #guide-level-explanation
23+
24+
The `Interface` class in `amaranth.lib.wiring` is renamed to `PureInterface`.
25+
26+
## Reference-level explanation
27+
[reference-level-explanation]: #reference-level-explanation
28+
29+
The `Interface` class in `amaranth.lib.wiring` is renamed to `PureInterface`.
30+
31+
## Drawbacks
32+
[drawbacks]: #drawbacks
33+
34+
Minor churn.
35+
36+
## Rationale and alternatives
37+
[rationale-and-alternatives]: #rationale-and-alternatives
38+
39+
The new name is, of course, subject to bikeshedding. The names that have been proposed are:
40+
41+
- `PureInterface`
42+
- `BareInterface`
43+
44+
## Prior art
45+
[prior-art]: #prior-art
46+
47+
None.
48+
49+
## Unresolved questions
50+
[unresolved-questions]: #unresolved-questions
51+
52+
None.
53+
54+
## Future possibilities
55+
[future-possibilities]: #future-possibilities
56+
57+
The name `Interface` that has just been freed up can be reused for an ABC-like class representing all valid interfaces.

0 commit comments

Comments
 (0)