Re: Challenge: adding new method overloads when existing consumers use {} with args
Am Samstag, 23. Juli 2022, 17:20:08 CEST schrieb Friedrich W. H. Kossebau: > Hi, > > (cc: kde-frameworks-devel for heads-up, please reply to kde-devel only) > > given a class C with a method foo(A a): > --- 8< --- > class C > { > public: > void foo(A a); > }; > --- 8< --- > > Now you want to add an overload, to serve further use-cases as requested by > API consumers: > --- 8< --- > void foo(B b); > --- 8< --- > > > But there is existing consumer code, making use of C++17, which calls > --- 8< --- > C c; > c.foo({}); > --- 8< --- > > So the new overload will not be source-compatible and break existing code, > for what my WE mood brain tells me. > > Which spoils the API evolving we have been doing so far e.g. in KDE > Frameworks quite a bit. > So far we seem to just have been lucky, but with more consumer code starting > to make use of C++17 features, the risk has grown and I just ran into this > the first time -> > https://invent.kde.org/frameworks/kwidgetsaddons/-/commit/ > e425aaa3025272cb70169354d04dfb3713f9783a#note_491339 > > Had not yet thought about this challenge myself before, so curious what > people think can be done here? > > Should perhaps the use of list-initializers with arguments in method calls > be discouraged, at least for plain {} ones, where no type information is > provided at all? Adding such an overload as in your example is source incompatible regardless. See also our guidelines. https://community.kde.org/Policies/ Binary_Compatibility_Issues_With_C%2B%2B#Note_about_ABI You cannot... For existing functions of any type: Add an overload (binary compatible, but not source compatible: it makes &func ambiguous). Adding overloads to already overloaded functions is ok (since any use of &func already needed a cast). > Cheers > Friedrich David
Re: Challenge: adding new method overloads when existing consumers use {} with args
Am Samstag, 23. Juli 2022, 17:20:08 CEST schrieb Friedrich W. H. Kossebau: > Hi, > > (cc: kde-frameworks-devel for heads-up, please reply to kde-devel only) Sorry replied wrong first :) > given a class C with a method foo(A a): > --- 8< --- > class C > { > public: > void foo(A a); > }; > --- 8< --- > > Now you want to add an overload, to serve further use-cases as requested by > API consumers: > --- 8< --- > void foo(B b); > --- 8< --- > > > But there is existing consumer code, making use of C++17, which calls > --- 8< --- > C c; > c.foo({}); > --- 8< --- > > So the new overload will not be source-compatible and break existing code, > for what my WE mood brain tells me. > > Which spoils the API evolving we have been doing so far e.g. in KDE > Frameworks quite a bit. > So far we seem to just have been lucky, but with more consumer code starting > to make use of C++17 features, the risk has grown and I just ran into this > the first time -> > https://invent.kde.org/frameworks/kwidgetsaddons/-/commit/ > e425aaa3025272cb70169354d04dfb3713f9783a#note_491339 > > Had not yet thought about this challenge myself before, so curious what > people think can be done here? > > Should perhaps the use of list-initializers with arguments in method calls > be discouraged, at least for plain {} ones, where no type information is > provided at all? Adding such an overload as in your example is source incompatible regardless. See also our guidelines. https://community.kde.org/Policies/ Binary_Compatibility_Issues_With_C%2B%2B#Note_about_ABI You cannot... For existing functions of any type: Add an overload (binary compatible, but not source compatible: it makes &func ambiguous). Adding overloads to already overloaded functions is ok (since any use of &func already needed a cast). > Cheers > Friedrich David
KDE CI: Frameworks » kio » kf5-qt5 FreeBSDQt5.15 - Build # 1754 - Unstable!
BUILD UNSTABLE Build URL https://build.kde.org/job/Frameworks/job/kio/job/kf5-qt5%20FreeBSDQt5.15/1754/ Project: kf5-qt5 FreeBSDQt5.15 Date of build: Mon, 25 Jul 2022 12:48:18 + Build duration: 4 min 20 sec and counting JUnit Tests Name: projectroot Failed: 1 test(s), Passed: 60 test(s), Skipped: 0 test(s), Total: 61 test(s)Failed: projectroot.autotests.kiocore_jobtestName: projectroot.autotests Failed: 0 test(s), Passed: 6 test(s), Skipped: 0 test(s), Total: 6 test(s)Name: projectroot.src.ioslaves.trash Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s)Name: projectroot.src.kpasswdserver Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s)
KDE CI: Frameworks » kio » kf5-qt5 SUSEQt5.15 - Build # 1739 - Unstable!
BUILD UNSTABLE Build URL https://build.kde.org/job/Frameworks/job/kio/job/kf5-qt5%20SUSEQt5.15/1739/ Project: kf5-qt5 SUSEQt5.15 Date of build: Mon, 25 Jul 2022 12:48:18 + Build duration: 7 min 2 sec and counting BUILD ARTIFACTS acc/KF5KIO-5.97.0.xml JUnit Tests Name: (root) Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s)Name: projectroot Failed: 1 test(s), Passed: 61 test(s), Skipped: 0 test(s), Total: 62 test(s)Failed: projectroot.autotests.kiocore_threadtestName: projectroot.autotests Failed: 0 test(s), Passed: 6 test(s), Skipped: 0 test(s), Total: 6 test(s)Name: projectroot.src.ioslaves.trash Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s)Name: projectroot.src.kpasswdserver Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s) Cobertura Report Project Coverage Summary Name PackagesFilesClassesLinesConditionalsCobertura Coverage Report61% (25/41)69% (299/433)69% (299/433)58% (39816/69061)42% (22145/52883)Coverage Breakdown by Package Name FilesClassesLinesConditionalsautotests94% (61/65)94% (61/65)91% (11503/12604)46% (7293/15948)autotests.http100% (5/5)100% (5/5)99% (527/528)58% (167/290)autotests.kcookiejar100% (1/1)100% (1/1)94% (173/185)63% (70/112)src100% (1/1)100% (1/1)89% (8/9)71% (10/14)src.core89% (110/124)89% (110/124)61% (9701/15902)53% (4840/9177)src.core.kssl100% (1/1)100% (1/1)38% (33/86)50% (2/4)src.filewidgets79% (31/39)79% (31/39)57% (5443/9494)44% (2317/5323)src.gui100% (12/12)100% (12/12)72% (947/1307)59% (488/832)src.gui.systemd50% (2/4)50% (2/4)4% (7/178)1% (1/108)src.ioslaves.file71% (5/7)71% (5/7)50% (695/1401)39% (483/1227)src.ioslaves.file.kauth0% (0/2)0% (0/2)0% (0/187)0% (0/83)src.ioslaves.ftp100% (1/1)100% (1/1)39% (530/1353)30% (433/1426)src.ioslaves.help0% (0/5)0% (0/5)0% (0/244)0% (0/138)src.ioslaves.http88% (7/8)88% (7/8)43% (1895/4357)37% (1376/3719)src.ioslaves.http.kcookiejar40% (2/5)40% (2/5)49% (664/1364)56% (588/1053)src.ioslaves.remote100% (2/2)100% (2/2)25%
KDE CI: Frameworks » kio » kf5-qt5 FreeBSDQt5.15 - Build # 1755 - Still Unstable!
BUILD UNSTABLE Build URL https://build.kde.org/job/Frameworks/job/kio/job/kf5-qt5%20FreeBSDQt5.15/1755/ Project: kf5-qt5 FreeBSDQt5.15 Date of build: Mon, 25 Jul 2022 12:52:41 + Build duration: 3 min 35 sec and counting JUnit Tests Name: projectroot Failed: 1 test(s), Passed: 60 test(s), Skipped: 0 test(s), Total: 61 test(s)Failed: projectroot.autotests.kiocore_jobtestName: projectroot.autotests Failed: 0 test(s), Passed: 6 test(s), Skipped: 0 test(s), Total: 6 test(s)Name: projectroot.src.ioslaves.trash Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s)Name: projectroot.src.kpasswdserver Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s)
KDE CI: Frameworks » kio » kf5-qt5 SUSEQt5.15 - Build # 1740 - Fixed!
BUILD SUCCESS Build URL https://build.kde.org/job/Frameworks/job/kio/job/kf5-qt5%20SUSEQt5.15/1740/ Project: kf5-qt5 SUSEQt5.15 Date of build: Mon, 25 Jul 2022 12:55:21 + Build duration: 5 min 17 sec and counting BUILD ARTIFACTS acc/KF5KIO-5.97.0.xml JUnit Tests Name: (root) Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s)Name: projectroot Failed: 0 test(s), Passed: 62 test(s), Skipped: 0 test(s), Total: 62 test(s)Name: projectroot.autotests Failed: 0 test(s), Passed: 6 test(s), Skipped: 0 test(s), Total: 6 test(s)Name: projectroot.src.ioslaves.trash Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s)Name: projectroot.src.kpasswdserver Failed: 0 test(s), Passed: 1 test(s), Skipped: 0 test(s), Total: 1 test(s) Cobertura Report Project Coverage Summary Name PackagesFilesClassesLinesConditionalsCobertura Coverage Report61% (25/41)69% (300/433)69% (300/433)58% (39841/69063)42% (22175/52889)Coverage Breakdown by Package Name FilesClassesLinesConditionalsautotests95% (62/65)95% (62/65)92% (11538/12607)46% (7318/15954)autotests.http100% (5/5)100% (5/5)99% (527/528)58% (167/290)autotests.kcookiejar100% (1/1)100% (1/1)94% (173/185)63% (70/112)src100% (1/1)100% (1/1)89% (8/9)71% (10/14)src.core89% (110/124)89% (110/124)61% (9691/15901)53% (4843/9177)src.core.kssl100% (1/1)100% (1/1)38% (33/86)50% (2/4)src.filewidgets79% (31/39)79% (31/39)57% (5443/9494)44% (2317/5323)src.gui100% (12/12)100% (12/12)72% (947/1307)59% (488/832)src.gui.systemd50% (2/4)50% (2/4)4% (7/178)1% (1/108)src.ioslaves.file71% (5/7)71% (5/7)50% (695/1401)39% (484/1227)src.ioslaves.file.kauth0% (0/2)0% (0/2)0% (0/187)0% (0/83)src.ioslaves.ftp100% (1/1)100% (1/1)39% (530/1353)30% (433/1426)src.ioslaves.help0% (0/5)0% (0/5)0% (0/244)0% (0/138)src.ioslaves.http88% (7/8)88% (7/8)43% (1895/4357)37% (1376/3719)src.ioslaves.http.kcookiejar40% (2/5)40% (2/5)49% (664/1364)56% (588/1053)src.ioslaves.remote100% (2/2)100% (2/2)25% (57/2