-
Notifications
You must be signed in to change notification settings - Fork 11
Do not use typedefs to hide that things are pointers #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not use typedefs to hide that things are pointers #342
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❌ Your project status has failed because the head coverage (80.49%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## TDE_REL_17_STABLE #342 +/- ##
=====================================================
- Coverage 80.49% 80.49% -0.01%
=====================================================
Files 22 22
Lines 2605 2604 -1
Branches 399 398 -1
=====================================================
- Hits 2097 2096 -1
Misses 430 430
Partials 78 78
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. This way (w/o hidden pointers) the code is more obvious and easier to reason about.
Btw, is there any justification behind that practice in the core? Or it's just a habit?
It is a weird habit from the PG project which is just annoying and many of the devs disagree with. I believe it is based on some idea that some data structures should be opaque and you just treat them as a handle. Let's do this! I hate these! |
Since we're 3/5 devs in the team liking this I'll convert it to a proper PR 😄 But won't merge if @dutow or @artemgavrilov hates it ofc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it! Going to typedefs that allias other typedefs to understad real type is pain. With this change code is easier.
And also remove the typedef that previously held the name TDESMgrRelation. This typedef hides the pointer-ness of things and only serves to make the code harder to read.
1ffd139
to
57716d0
Compare
This suggestion renames
TDESMgrRelationData
toTDESMgrRelation
and removes the previous typedef that held that name. I think the code is much easier to read if we don't try to hide that something is a pointer using typedefs.The pointer hiding typedef is a common postgres code pattern however, so I understand if not everyone is on-board with this idea for consistency with the core code, but I though I should at least bring it up for discussion 🙂.