Public
So Digia released a for-paying-customers-only QML compiler for Qt 5.3.(Link below).
Looking at the state of the compiler internals, an openly developed compiler could be achieved without too much effort.
My guess as to why Digia made it for-paying-customers-only:
* gives a reason for people to pay (get access to cool stuff first! sort of against the spirit of the FreeQt foundation, but hey, business is business ..)
* it relies on QML internals and you don't want to support that between versions in the open; given all the comments in the sources around data structures and classes that will change "when the old compiler is gone" (referring, I believe, to the QML compiler), I would feel similarly
* it is built with limitations that render it only useful for proprietary applications, esp on mobile platforms; I suspect, though I haven't seen it in action, that it doesn't make sharing compiled units easy (or perhaps even possible) and that it doesn't support compiled-with-QML-sources-as-fallback-in-case-of-arch-or-QML-version-mismatch
I would expect, however, that if Digia doesn't move to open this compiler by Qt 5.4/5.5 that someone will step up and do the obvious work needed to make one everyone can use. I just don't see Plasma Next or Ubuntu Touch suffering slowness forever because they have to parse QML files ... (not to mention potential benefits of avoiding memory fragmentation and faster object access as they could all be laid out contiguously in memory ...)
As a positive side-note, the new in-memory representation of QML and JS objects now that QtQuick uses its own JS runtime makes this rather easy to accomplish.
.. and in case any QML devs are reading this: if QV4::Compiler::JSUnitGenerator::generateUnit took an optional allocator function, then a sizable malloc/free could be saved in QmlUnitGenerator::generate without ruining the generic nature of QV4::Compiler::JSUnitGenerator::generateUnit.
Looking at the state of the compiler internals, an openly developed compiler could be achieved without too much effort.
My guess as to why Digia made it for-paying-customers-only:
* gives a reason for people to pay (get access to cool stuff first! sort of against the spirit of the FreeQt foundation, but hey, business is business ..)
* it relies on QML internals and you don't want to support that between versions in the open; given all the comments in the sources around data structures and classes that will change "when the old compiler is gone" (referring, I believe, to the QML compiler), I would feel similarly
* it is built with limitations that render it only useful for proprietary applications, esp on mobile platforms; I suspect, though I haven't seen it in action, that it doesn't make sharing compiled units easy (or perhaps even possible) and that it doesn't support compiled-with-QML-sources-as-fallback-in-case-of-arch-or-QML-version-mismatch
I would expect, however, that if Digia doesn't move to open this compiler by Qt 5.4/5.5 that someone will step up and do the obvious work needed to make one everyone can use. I just don't see Plasma Next or Ubuntu Touch suffering slowness forever because they have to parse QML files ... (not to mention potential benefits of avoiding memory fragmentation and faster object access as they could all be laid out contiguously in memory ...)
As a positive side-note, the new in-memory representation of QML and JS objects now that QtQuick uses its own JS runtime makes this rather easy to accomplish.
.. and in case any QML devs are reading this: if QV4::Compiler::JSUnitGenerator::generateUnit took an optional allocator function, then a sizable malloc/free could be saved in QmlUnitGenerator::generate without ruining the generic nature of QV4::Compiler::JSUnitGenerator::generateUnit.
View 39 previous comments
Well, the API is open. How do you think the existing compiler works?Nov 4, 2014
I would have assumed the code that loads the compiled QML files is closed source and only in the commercial versions of Qt. Glad that's apparently not the case though (right?).Nov 4, 2014
I don't know anything about the non-open source code. My point is that it's a standard qtdeclarative in their case, unmodified. So if they can do it, why couldn't this other implementation?Nov 4, 2014
Practical reasons why not: it uses internal API that is likely to change in future and which Digia maintains/controls. (Not that they would maliciously change it just to screw with other implementations, but the APIs they are relying on are not public because they are not settled.)
So it's a good 6-8 months of full-time work by someone who knows QML internals well .. only to have it probably broken in a future release.Nov 5, 2014
From what I could tell when attending Simon's talk at Qt DevDays, it looks as if they generate C++ from the intermediate code generated by the v4 engine, so they rely on that infrastructure.
Then they do some tricks to replace qml-files in the qrc-files with these cpp-files.
Hence, I believe that as long as v4 is around, the compiler will use the same APIs.Nov 5, 2014
+Johan Thelin: yes, but it might subtly change.Nov 5, 2014
Add a comment...