Great macro shuffle: req, and effect#8720
Merged
Merged
Conversation
Contributor
|
Woot! I know it is a lot of changes but as a newer who found the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Originally,
effectwas a way to write the abilities/effects of card abilities in a concise way. Because everything tookstateandside, it was easy to trim those and have a list of actions that happened one after another. With the advent of "async" abilities and the growing complexity of our abilities, it stopped being useful a long time ago but I only got around to removing it a couple days ago (in #8718).With that done, the question became "is
reqstill a good name for the base macro?" After discussion with the team, we determined that it was not, and we should in fact match:effectwitheffectand:reqwithreq. That has resulted in this behemoth.In short,
effectis now whatreqused to be, a macro that expands to a function takingstate,side,eid,card, andtargets. It binds the appropriate variables but otherwise doesn't do anything else. Andreqis now a macro relying oneffectthat wraps all forms in an implicitandto make it easier/more readable to check conditions. 90% of uses of the:reqfunction were a single check or a handful of checks that were wrapped in anandalready, so stripping those was fairly simple. The more complex cases can continue to rely on aletas(and (let [...] (and ...)))is a no-op.I did no indentation fixes so as we edit these files, we'll probably see some ancillary changes which I think is better than updating the indentation of ~50 files.
It will take some getting used to but I believe in us. A better world is possible, we just have to rely on
rewrite-clj.