I reduced boilerplate - #1277
Conversation
|
Renaming the raw, explicit
Again, this is just subjective opinion. And it ignores the fact this library is older than the introduction of "Isolate" naming in V8. PerContextData is perfectly fine as is. I have looked at both your PRs and they both have the same problem - you mix arbitrary refactorings with functional changes. An arbitrary refactoring PR is problematic alone, but an arbitrary refactoring PR mixed in with subtle functional changes is frankly unmergable. If you find a single functional fix - make that, and only that, a separate PR that tries to make as minimal change as possible. If you have opinions on formatting or style, make a PR that only performs that style change (literally nothing else). Ideally, you should also provide some verifiable proof that the style change is identical to the original (such as providing a proof of the style rules you applied into clang-format so that I can confirm that you did not introduce functional changes). Your PRs have the style of "here is my playground, I have done this and this and this, some of it is functional change, some is subjective" - that kind of PR is impossible to deal with. A PR needs to be surgical, only change what is necessary for your fix and provide reason why the fix is even necessary (such as the setbuf thing in your other PR - provide proof of its usefulness) |
|
Git is a crime scene - the less you can move things around while still getting the job done, the better. That's why any kind of refactoring is bad alone - but a refactoring that ALSO changes functionality in subtle ways is very bad (I'm mainly thinking of your other PR). When you change lines that aren't necessarily changed, you damage the ability to easily backtrack if something breaks. That's why not changing something that does not need to change is better than doing it just because it can be changed. There is also the social friction component - changing things based on subjective opinion assumes that your opinion is heavier than others (or that the original author does not know how to wrap things). You aren't following the social convention of "when in rome do as the romans do". |
|
Alright, understood. So in this particular PR, only lambdas have any use? And also that you mentioned other PR has some kind of functionality change. You mean the fix of MacOS 12 additional option? That's why it is still "hanging"? |
|
Then I have to make even more niche PRs. I close this one and that. |
|
Thanks for patience |
|
I think what you are missing is you look at the source file as a whole and say "this file now looks fine, it is how I want it", make a PR of it. Rather than look at the PR itself and say "this diff looks surgical & reviewable". You can use "git add -p" to produce surgical PRs |
…ity in every file); renamed PerContextData to PerIsolateData (it has more meaning); replaced 'const FunctionCallbackInfo&' onto 'args_t'; reduced boilerplate in 'init' functions
As the name suggests, why suffer? I did following changes for DX within C++ codebase:
Made Utilities.h central header-file (clangd LSP sees Http3 functonality in every file). Basically I put
#include <v8.h> #include "App.h" #include "Http3App.h" using namespace v8into Utilities.h;renamed PerContextData to PerIsolateData. In fact, this struct is local to each V8 instance, which is Isolate. If it is "per isolate", why not be "PerIsolateData" ?;
replaced 'const FunctionCallbackInfo&' onto 'args_t'. Name is self-explanatory (type for arguments), much easier to write;
reduced boilerplate in 'init' functions. I put registering functionality into lambdas, so they don't live on the global stack and this saves tons of effort when trying to figure out what code does.
So while I have a draft for build improvements, I have also made a draft for C++ DX + type-safety (coming in subsequent PRs). This is the first pull request. Again, it compiles with old build and with build.exe from my other pull-request.