Skip to content

Commit c4727d6

Browse files
committed
RFC: "Remove Const.normalize"
1 parent 2af204d commit c4727d6

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

text/0000-remove-const-normalize.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
- Start Date: (fill me in with today's date, YYYY-MM-DD)
2+
- RFC PR: [amaranth-lang/rfcs#0000](https://github.com/amaranth-lang/rfcs/pull/0000)
3+
- Amaranth Issue: [amaranth-lang/amaranth#0000](https://github.com/amaranth-lang/amaranth/issues/0000)
4+
5+
# Summary
6+
[summary]: #summary
7+
8+
Remove `Const.normalize(value, shape)`.
9+
10+
# Motivation
11+
[motivation]: #motivation
12+
13+
From the name it is not clear what it is supposed to achieve (it's truncation and inversion according to the shape) and it does not check types of arguments.
14+
15+
We already have `Const(value, shape).value` and most developers should be aware of it. Having `Const.normalize(value, shape)` as well provides no benefit over the former. It's also longer.
16+
17+
# Explanation
18+
[explanation]: #explanation
19+
20+
The `Const.normalize` method is deprecated (with the suggestion to use `Const().value`) and removed.
21+
22+
# Drawbacks
23+
[drawbacks]: #drawbacks
24+
25+
- Churn.
26+
27+
# Rationale and alternatives
28+
[rationale-and-alternatives]: #rationale-and-alternatives
29+
30+
We could keep it. Removing it reduces the API surface and makes the language a bit more elegant.
31+
32+
# Prior art
33+
[prior-art]: #prior-art
34+
35+
None.
36+
37+
# Unresolved questions
38+
[unresolved-questions]: #unresolved-questions
39+
40+
None.
41+
42+
# Future possibilities
43+
[future-possibilities]: #future-possibilities
44+
45+
None.

0 commit comments

Comments
 (0)