[Development] Some Qt3D feedback
Marc Mutz
marc.mutz at kdab.com
Tue Jun 16 15:41:22 CEST 2015
On Tuesday 16 June 2015 11:39:56 Ulf Hermann wrote:
> > Note that in a world of auto variables, class names are no longer _that_
> > important. Functions are important, they are still visible. But other
> > than at initial creation, class names fade to be background.
> >
> > And now you tell me how using lots of auto is bad for readability,
> > because you never know what type the variable has, to which I will
> > reply that in Python, Perl, PHP, JavaScript and others, there's no
> > way to spell the type of a variable, and people write very large
> > projects in these languages and never look back.
>
> Uh, no, you either don't write large projects in PHP (or Perl), or you do
> look back with *fond* memories. At least that's my experience. And the
> insane type system of PHP definitely has something to do with this. So, I
> do like to make it clear what types I'm using (except for specific
> situations like iterators in loops) and namespaces can definitely help
> here. I understand we're not exposing them in public API today, but that
> doesn't mean they're useless.
Don't confuse the problems of dynamic type systems with not mentioning the
variable type.
This is the style advocated by the likes of Scott Meyers:
auto widget = new QWidget(this);
auto layout = new QVBoxLayout(widget);
auto le = new QLineEdit(widget);
For type conversions, you're supposed to use static_cast on the rhs:
auto integer = static_cast<int>(someLongLong);
All this is still statically typed, and at some point QtC will show you the
type of the variable when you hover, if it doesn't already.
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts
More information about the Development
mailing list