[WIP] Refactor the definitions of RPC functions#63
Open
kermorgant wants to merge 1 commit intoemacs-php:masterfrom
Open
[WIP] Refactor the definitions of RPC functions#63kermorgant wants to merge 1 commit intoemacs-php:masterfrom
kermorgant wants to merge 1 commit intoemacs-php:masterfrom
Conversation
---------------------------------------------------------------- IMPORTANT: This code is unfinished and needs a lot more testing. Developers should not build off this commit because it is highly likely we will rebase it once we address all problems. ---------------------------------------------------------------- We define a number of functions whose sole purpose is to invoke Phpactor's RPC commands. The majority of these functions are the same. That is, their only real difference is the name of the RPC command and what we pass to our `phpactor--rpc` function. This patch refactors that code for multiple purposes. 1. We now only need to change one place to add support for a new command: the 'phpactor--rpc-command-data' list. The exception to this are the few RPC commands like "echo" which require additional arguments. It seemed easier to leave those few functions as they are instead of trying to shoe-horn support for a corner case into our now macro. 2. The new 'phpactor-defrpc' macro automatically creates the functions we previously wrote by hand. This both reduces bloat and decreases chances for errors, since now our code for such functions is all in one place: the macro definition itself. 3. We create a list of relevant data about the RPC commands which we can loop over, apply our new macro to each. This lets us introduce support for a new RPC command by modifying a single line in a list as opposed to writing an entire function. (Again, the exception are those few commands like "echo" which require additional arguments.)
Contributor
Author
|
I was going to give this another try but this time, it starts giving this type of error
|
|
I get the same issue. Maybe instead of a macro we replace it with a function-defining-function and then |
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.
Thanks to @ejmr for this pull request (he's the author of this proposal)
IMPORTANT: This code is unfinished and needs a lot more testing.
Developers should not build off this commit because it is highly
likely we will rebase it once we address all problems.
We define a number of functions whose sole purpose is to invoke
Phpactor's RPC commands. The majority of these functions are the same.
That is, their only real difference is the name of the RPC command and
what we pass to our
phpactor--rpcfunction. This patch refactorsthat code for multiple purposes.
We now only need to change one place to add support for a new
command: the 'phpactor--rpc-command-data' list. The exception to
this are the few RPC commands like "echo" which require additional
arguments. It seemed easier to leave those few functions as they
are instead of trying to shoe-horn support for a corner case into
our now macro.
The new 'phpactor-defrpc' macro automatically creates the functions
we previously wrote by hand. This both reduces bloat and decreases
chances for errors, since now our code for such functions is all in
one place: the macro definition itself.
We create a list of relevant data about the RPC commands which we
can loop over, apply our new macro to each. This lets us introduce
support for a new RPC command by modifying a single line in a list
as opposed to writing an entire function. (Again, the exception are
those few commands like "echo" which require additional arguments.)