2 small questions on "import" statement
Pavel Vasev
pavel.vasev at gmail.com
Tue Mar 17 14:32:05 UTC 2015
Hi Anton!
I have added tests to github's pull request.
Many thanks to you for warning me!
I had to do the import thing because it is required for my project.
After that, QmlWeb's core looks like complete (for my needs).
BTW We have started an attempt to create some QtQuick.Controls components.
They are build as qml-files, so it will be usable even in your new compiler.
In case of some success with those components, I will notify you.
Best Regards,
Pavel
С уважением,
Павел Васёв
2015-03-17 13:41 GMT+05:00 Anton Kreuzkamp <anton at akreuzkamp.de>:
> Hi,
>
> thanks again a lot for your code!!
> I think we can ship it (as soon as we have tests) and go to improve it
> there. :)
>
> Please note: As I already wrote, a friend of mine and myself are currently
> working on a new iteration of
> QmlWeb, that will be compiled. For this purpose I'm rewriting the runtime
> from scratch (reusing parts,
> that can be reused of course). Surely, the import stuff is very valuable
> for that as well (again: thanks, I'm
> very happy about it), still, quite some of the work will be done by the
> compiler (what's left is like "load
> module from http://example.com/coe/myModule.js and make it available.").
>
> So please do not put too much blood, sweat and tears in stuff, that
> unfortunately won't live for long...
> (don't get me wrong, I very much appreciate your work, I just want to
> avoid you being disappointed, if I
> need to replace it, because the compiler now does the work)
>
> Cheers, Anton
>
>
> On 17.03.2015 08:48, Pavel Vasev wrote:
>
> Hi Anton!
>
> I have implemented initial version of imports. They work! ;-)
> The code in my original pull request:
> https://github.com/akreuzkamp/qmlweb/pull/1
>
> p.s. Probably that pull request is "stale". Please note me and I will
> try to do something...
>
> С уважением,
> Павел Васёв
>
> 2015-03-13 13:42 GMT+05:00 Pavel Vasev <pavel.vasev at gmail.com>:
>
>> Hi Anton!
>>
>> I tried to use/implement import statement.
>>
>> Because it is already semi-implemented, I hoped it will be
>> easy task. However I cannot complete it without your help.
>>
>> 1. Could you please fix parser to allow "." (dot) in component names.
>> E.g:
>> ``````````````````````````````````````
>> import components.scatter 1.0 as ScatterScene
>>
>> Item {
>> ScatterScene.App
>> {
>> ^ Parser says here: Unexpected token punc undefined, expected punc
>> }
>> }
>> ``````````````````````````````````````
>> Probably this is not a "dot in component names" problem, but it anyway
>> refuses to parse...
>>
>>
>> 2. Path lookup - need your advice.
>>
>> I found that `parseQML` function returns $imports array.
>>
>> I checked and see that after parseQML you always call
>> `new QMLComponent` method. E.g:
>> ``````````````````````````````````````````````
>> var tree = parseQML(src);
>> var component = new QMLComponent({ object: tree, context:
>> executionContext });
>> ```````````````````````````````````````````````
>> So I think it is possible to keep `tree.$imports` value somewhere in
>> component,
>> here or inside QMLComponent constructor.
>>
>> The goal for keeping $imports of current component is to have access to
>> it in
>> `construct` function when constructing the children of current
>> document.
>>
>> We can perform some cached lookups of qmldir files contents and decide
>> whenever we should use component from some qmldir file.
>>
>> For now, I digged a little to your code and I cannot understand, where
>> is it better to keep $imports? I tried metaobject, and context, but seems
>> they are not what I need.
>> Could you please make some advice?
>>
>> Best Regards,
>> Pavel
>>
>> p.s. I understand that most of your efforts currently are on qml-to-js
>> convertor.
>> However it doesn't seem to be ready tomorrow, because it is not easy
>> task.
>> And current parser/qtcore are "working things". So please give some
>> attention to them too, because they are just working... Thank you!
>>
>
>
>
> _______________________________________________
> QmlWeb mailing listQmlWeb at kde.orghttps://mail.kde.org/mailman/listinfo/qmlweb
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/qmlweb/attachments/20150317/f8bec3fc/attachment.html>
More information about the QmlWeb
mailing list