[Development] How to port from Q_FOREACH to range-based for
André Pönitz
apoenitz at t-online.de
Tue Jun 11 21:38:38 CEST 2019
On Tue, Jun 11, 2019 at 11:49:11AM +0200, Giuseppe D'Angelo wrote:
> On 11/06/2019 09:17, Lars Knoll wrote:
> > So, is removing it worth all the hassle to us and our users? Q_FOREACH is
> > a macro and it doesn’t really cost us anything to keep it around. Yes, it
> > has issues with non Qt containers and I wouldn’t recommend it for any new
> > code.
>
> In fact, I wasn't proposing removal, only deprecation -- the other thread
> was started because an hypothetical removal in 6.0 would badly hit users.
You seem to think of deprecation as harmless.
It is not.
It makes uses of that code look bad, fail to compile and be shippable in
certain contexts and it is active progress in bitrot, even for completely
fine functional code, like e.g. when using the now 'bad'
QComboBox::currentIndexChanged(const QString &) overload.
By deprecating things your are actively damaging existing user code
-- and even Qt code, as the deprecators typically don't even bother to
"fix" *that*.
You need a *really* good reason to do deprecations, effectively coming up
with a credible scenario that shows a total expected benefit over
in reality existing total downstream costs.
> For the "why", you just said it: you wouldn't recommend its usage for
> any new code, so why should anyone else use it?
Because it is in the code already, and touching code is an effort.
Andre'
More information about the Development
mailing list