Hi,
after some more experimentation, I've realized the problem is actually
of larger dimension. Since function signatures are ignored when
interpreting or running JIT-compiled QML code, you already get divergent
behavior without all the value type write back problems. Take for
example the fol
This becomes more and more non-intuitive.
let a: font = f // copy f because a is value-typed?
That syntax doesn't exist in QML. You can only type-annotate function
arguments and return types, but not locals.
let b = a // copy because a is typed, and b's type is inferred
from a
Should there be a way to pass by reference even when using type annotations?
Providing a way to pass by reference for type annotated functions will
probably in people expecting such code to be compiled to C++. I would
only provide such syntax if qmlcachegen and qmlsc can deal with it. If
it's
This becomes more and more non-intuitive.
let a: font = f // copy f because a is value-typed?
let b = a// copy because a is typed, and b's type is inferred
from a?
let c = f// ref because f is JS-ish type
function foo(arg) {
return arg
}
let d = foo(b) // ref becau
Generally I feel that all the gritty details in what to do and what
not do in qml to have efficient, compiled code, are more and more
confusing. There is so much to consider and basically all the
documentation about this is hidden in Qt blog posts.
Well, yes. All of this is 10 years late and we
On Wed, 21 Sep 2022 14:59:08 +0200, Ulf Hermann wrote:
> If a function has type annotations, we pass its arguments and return
> value by value (if they are value types). Otherwise we pass by
> reference. Inside a function, everything is a reference.
>
> This makes some intuitive sense: The type an
> On 2022 Sep 21, at 14:59, Ulf Hermann wrote:
>
> Thanks for the feedback! I've thought about it some more and done some
> experiments and I think we can solve this in a way that makes everyone happy:
>
> If a function has type annotations, we pass its arguments and return value by
> value (
Hi,
Generally I feel that all the gritty details in what to do and what
not do in qml to have efficient, compiled code, are more and more
confusing. There is so much to consider and basically all the
documentation about this is hidden in Qt blog posts.
Anyway I'd just like to note that, as far as
Thanks for the feedback! I've thought about it some more and done some
experiments and I think we can solve this in a way that makes everyone
happy:
If a function has type annotations, we pass its arguments and return
value by value (if they are value types). Otherwise we pass by
reference.
Thanks for writing this up, Ulf!
Working on porting Qt Location to Qt 6 right now, I’m looking very much forward
to the improved support for value types :)
> On 20 Sep 2022, at 18:13, Ulf Hermann wrote:
>
> Hi,
>
> I'm currently trying to transform QML value types, such as font, rect,
> size
> 1. Value types are passed by value
> 2. Everything is a reference
Most languages have a way to specify this in the signature. Swift has the
“inout” keyword, c# has “ref”. Have you considered this as an option as well?
BR,
Richard
___
Development mai
Hi,
I'm currently trying to transform QML value types, such as font, rect,
size, etc, into something less random and more predictable. On that
occasion I'm wondering what semantics people actually expect from value
types.
One thing you have to know in advance is that QML has this internal
con
12 matches
Mail list logo