[Development] Views

Konstantin Shegunov kshegunov at gmail.com
Tue May 21 10:24:54 CEST 2019


On Tue, May 21, 2019 at 9:34 AM Mutz, Marc via Development <
development at qt-project.org> wrote:

> [...]
> This does not make the API simple to use.


Actually it does. Simple, as "easily understood or done" and
self-explanatory, which isn't the case for the Q3Slider's constructor. Yes,
familiarity plays a role in that, but doesn't conflict with simplicity.


> It introduces two different ways to do essentially the
> same thing


So? The standard does that too. Before the lambda from c++11 we implemented
that idiom as a function object. We had the tools to do it and it worked
just as well. It can still be done instead of using the shorthand syntax.
I, personally, have found it rather curious that each new revision of the
language claims more expressiveness and simplicity, while the STL on the
other hand is restricted to the box of "universality"; in the end there's
nothing more universal than a naked C-style array.


> advocating the ways that only works in a particular
> corner-case and refusing to show the universal way
>

To paraphrase: You're confusing universality with simplicity.


> Had the Qt API and the docs not lied to them by
> permanently showing contains() without mentioning that it's but a
> short-cut for a corner-case, but shown them std::find or std::remove
> instead, the developer would have been empowered.


I object to the "corner-case" description, otherwise I'm with you
(partially). There should be some promotion in the docs of the iterators,
for example with regards to find-and-erase vs. remove() (e.g. QHash, QMap).
Especially whenever you actually need to get the value before removing.


> As-is, Container::contains() dumbs the novice down by telling him a
> fairy-tale
> that isn't applicable to actual professional work.
>

Actually it doesn't. I continue to claim that contains() is a convenient
shorthand when you are only interested whether something has something,
which if I had to pull a number off thin air probably constitutes ~5% up to
~10% of the cases where you search. This doesn't qualify for an edge-case,
and most certainly doesn't exclude professional work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190521/34e7cc2d/attachment.html>


More information about the Development mailing list