Repository navigation
WIP: Make CScript addition concatenative - #18613
JeremyRubin wants to merge 1 commit into
Conversation
|
Tests should be easy to write, and easy to read. Why can't this nonsensical operator on scripts be marked deleted in favour of self-documenting ones like |
|
I'm open to whatever, I just think this is a bit too much non WYSIWYG of an idiom so happy for any replacement. |
|
I've replaced the implementation with |
|
For future reference, @MarcoFalke is referring to the line in So I guess this can be replaced by a "pushdata" method, e.g. Or better, since I think it would be natural to assume |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
This has come up in some testing related stuff I've been working on... Opening as a WIP because a lot of stuff fails as a result and trying to decide if it's worth fixing or if I should ignore it...
Currently:
It doesn't seem like there's a way to reach
CScript(["hello", "world"])other than by chaining the iterators together, which is clunky.This patch redefines addition of scripts such that:
Note that adding a raw bytes to a CScript preserves the old behavior, e.g.,
CScript(["hello"]) + "world" == CScript(["hello", "world"]).An alternative to this is to get rid of the
nestedparameter to__coerce_instanceand always leave CScript as concatenative -- e.g.,CScript([a,CScript([b])]) == CScript([a,b]) == CScript([a]) + CScript([a,b])and you have to coerce to bytes first to get a push. This breaks fewer tests, but seems a bit more subtle?