-
Notifications
You must be signed in to change notification settings - Fork 178
Make AST nodes immutable #1067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Milestone
Comments
This is now unblocked since #1066 is solved. |
wanda-phi
added a commit
to wanda-phi/amaranth
that referenced
this issue
Feb 28, 2024
This is completed by #1165, with the caveats that |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now it's actually possible to do things like "set
sig.width
on aSignal
" or "modifyc.parts
on aCat
". This has never been explicitly advertised as something that is supported and is arguably a misuse of the API. Amaranth internally treats AST nodes as immutable; all fragment transformers create new ones, and it doesn't mutate them elsewhere. Any mutation would happen only in downstream code (there's one instance deep in the FSM code generation, #1066).Now that I'm working on reference documentation I'd like to either state that
Value
s are immutable and make them so, or else document them as mutable. This could potentially break some downstream code though, so I'm nominating this for discussion.If we decide that the nodes should be mutable, then setters must be introduced that typecheck the assignments.
The text was updated successfully, but these errors were encountered: