576 views
in GUI Development by
I can see that this is possible from intrinsic functions returning handle or from the native{} section, but not possible from the chora code.

1 Answer

0 votes
by

Hi,

in Chora such cast is not supported. This is because data type handle is target specific. While the data type int32 is guaranteed to be 32-bit integer on every target system, handle can become 64-bit on a 64-bit system. Conversion between handle and int32 would then lead to data loss.

Do you have a special application case to convert between handle and integer?

Best regards

Paul Banach

by
What about casting from int32 to bool?
by

Hello Gazi,

in Chora there is actually no direct type-cast operation from int32 to bool. Instead it is always necessary to compare the integer value with e.g. a number: if ( v != 0 ) .... This strict behaviour should limit possible error sources and ambiguity.

We know that this limitation is odd for users having experience with C, JavaScript, etc. Our next release will address this limitation as well as other aspects of Chora to make it more similar to C, JavaScript, etc.

Does it help you?

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint

...