Add more setcoeff!
methods and use them to deduplicate PolyRingElem constructors
#1911
+140
−369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unfortunately this won't work as I try to access attributes/parents of elements in
setcoeff!
before they are set.I see two ways to resolve this issue:
setcoeff!
gets an optional fourth argument, that is aUInt
fornmod_poly
-based types and afmpz_mod_ctx_struct
forfmpz_mod_poly
-based types. If this fourth argument is not passed, we can reconstruct it (in many cases, but not inside of the constructors as parents are not available).I would tend to 2 for now, and maybe remove this fourth argument again once 1 has made enough progress. What do you think @fingolfin ?