Re: gtkmm and C++0x




I appreciate that, as I once strongly believed in hungarian notation. I
don't any more, though I can't explain why.
I really don't like the hungarian notation. Thinking about this further,
using auto may make people use hungarian notation again, because
the type is not so visible anymore. They'll want to embed it in the variable
name instead (for clarity or whatever).

I guess it would be enough to always use meaningful variable names. "w"
is a crappy variable name anyway.
Sure, but then again, the name of the variable shouldn't exactly reflect its
type either (otherwise, we'll be back to the (imho, awful) hungarian notation).
So, without auto, the questions like "is it a RefPtr to Gtk::UIManager" or
"is it a pointer to Gtk::UIManager" or "is it a Gtk::UIManager object" are
easily answered. With auto, I'm not so sure.
Remember that we're talking about people who are probably learning
gtkmm or its components (otherwise, they wouldn't be looking at examples
in the first place).

This all relates to the documentation code. The library and application code
is, of course, a completely different matter.

Thanks,
Alexander

I really don't like "auto". C++ is a type-oriented language, auto will just cause problems with highlighters and will most of the time just be used to skip the real type.

The only place where auto might be useful are templates.
On the other hand, this could allow scenarios, which were only possible in templates before.

auto widget = get_widget(); //get_widget() can be overwritten
do_something(widget); //this will pick the best-fitting do_something()

The currently way to accomplish this would be something like that:

Widget* widget = get_widget();
widget->do_something(); //this needs to be inside the class

But i really don't find anything where this may be used when using gtkmm...


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]