[SERVER-58110] IDL: getters sometimes have const value return types Created: 28/Jun/21  Updated: 29/Oct/23  Resolved: 29/Apr/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: sa-remove-fv-backlog-22
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-65851 Remove concept of is_const_type from ... Closed
Related
related to SERVER-58111 IDL: remove ref-qualification on getters Closed
related to SERVER-65278 fix clang-tidy v4 issues and add v4 c... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2022-05-02, Service Arch 2022-05-16
Participants:

 Description   

IDL getters sometimes have const value return types.
This is an antipattern and pessimization we should get rid of.
Doing so would simplify the IDL generator anyway.



 Comments   
Comment by Githook User [ 29/Apr/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-58110 IDL remove const-returning getters
Branch: master
https://github.com/mongodb/mongo/commit/6080d01374318ab0a9e6be4ba0f0c1643caaf3a7

Comment by Billy Donahue [ 25/Apr/22 ]

It makes sense for SERVER-58110 and SERVER-SERVER-58111 to be fixed with the same commit.

Comment by Billy Donahue [ 22/Apr/22 ]

This is now blocking a clang-tidy upgrade. Taking it on as a bgtask.

Comment by Billy Donahue [ 01/Sep/21 ]

Link to justification if any is needed.
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#note-57

Comment by Billy Donahue [ 29/Jun/21 ]

If a function gives me a std::vector<StringData> (by value), it's none of that function's business what I do with it after the call. It's mine now.
The const qualification is an unnecessary restriction on the callers. Practically it prevents those callers from doing an efficient move of the return value.

Generated at Thu Feb 08 05:43:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.