Gregory spaketh:

> > <snip>,
> > So I was wondering, would it be possible, from a technical point of
> > view (not a product manager / roadmap POV), to have some kind of
> > static analysis tool that could tell at compile time that some signal
> > / slots names have changed ?
>
> Christian respondeth:

> Yes, it's possible - and something we want to have in Qt Creator.
>
> In fact, for types defined in a QML plugin, Creator will often already be
> able
> to offer code completion and error reporting. What the static analysis
> can't do
> yet is get the types right when you embed QML in a C++ application and
> expose
> some random objects (say using setContextProperty).
>
> It's under investigation though.
>

+1 to this idea.

This is something I've been thinking about a lot.

We all see the trend for more static analysis and "helps" like code
completion and syntax highlighting, this will get increasingly rich for
"studio" and "designer-level" tools to "connect" the QML and C++ side, and I
really like where QtCreator is going.  Of course, this implies the "context"
of types and methods at the point of code editing, but this similarly
relates to generating code and system metrics, identifying/adapting to
interface/code/type changes, integration with the "test" system (including
updates to the tests, ideally generated "for free"), issues tracking, etc.

It's really a very interesting problem.

But, to the original point, static analysis would be *great*.  Yesterday I
lost time because I left the parens off my "slot" (a silly error, can't
believe I did that):

//WHAT I DID:
connect(&other, SIGNAL(mySignal()), this, SLOT(mySlot));
//WHAT I SHOULD HAVE DONE:
connect(&other, SIGNAL(mySignal()), this, SLOT(mySlot()));

Of course, the slot never fired, and in this case it took me a while to
track that down, but that would have been an *ideal* catch for static
analysis.  (Bonus points for catching signal/slot type changes and
disallowed coercion.)

(An aside, I'm investigating a QML interface wrapper to a build system, with
states implemented/reflected in QML to reflect current build engine activity
in C++.  A by-product of this build system happens to be metrics from static
analysis, so I've been thinking about doing similar work.)

--charley
_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to