You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing the bindings for the UI-ng library, which is a thin wrapper around mac, windows and gtk graphical widget APIs. It can compile statically and I think it could be a great base for writing native looking apps for those platforms in V.
The problem I'm facing is that the API takes uiControl types as a generic cast (union like) for all the type of widgets, no matter if they are boxes, labels or buttons. So to make this typable in the V side I use an union type using this:
type Control = C.uiButton | C.uiLabel | C.uiBox | Button | Label | Box
Which results in a problem because V uses a HEAP cast when tranalsting this to C instead of just passing the pointer with a bare cast. To keep the V usage as simple as possible I didn't wanted to create a full abstraction of all this, and i think it will be doable if V could express that kind of uses somehow without an unboxing.
Reproduction Steps
The commit ec0951ac4405aaf7152c491ad925accfec5f625b shows the problem because i managed to get it to work by using unsafe voidptr
Expected Behavior
make the api typable iinstead of depending on voidptr
Current Behavior
segfault if i use typed variables
Possible Solution
i'm not as good as i would about the V internals to understand which should be the right behaviour on using an union type with multiple C types which end up 1:1 mapped with V. So i'm filling a ticket here as requested in the Discord to find a better solution before continue working on finishing the bindings.
Describe the bug
I'm writing the bindings for the UI-ng library, which is a thin wrapper around mac, windows and gtk graphical widget APIs. It can compile statically and I think it could be a great base for writing native looking apps for those platforms in V.
The problem I'm facing is that the API takes uiControl types as a generic cast (union like) for all the type of widgets, no matter if they are boxes, labels or buttons. So to make this typable in the V side I use an union type using this:
type Control = C.uiButton | C.uiLabel | C.uiBox | Button | Label | Box
Which results in a problem because V uses a HEAP cast when tranalsting this to C instead of just passing the pointer with a bare cast. To keep the V usage as simple as possible I didn't wanted to create a full abstraction of all this, and i think it will be doable if V could express that kind of uses somehow without an unboxing.
Reproduction Steps
The commit ec0951ac4405aaf7152c491ad925accfec5f625b shows the problem because i managed to get it to work by using unsafe voidptr
Expected Behavior
make the api typable iinstead of depending on voidptr
Current Behavior
segfault if i use typed variables
Possible Solution
i'm not as good as i would about the V internals to understand which should be the right behaviour on using an union type with multiple C types which end up 1:1 mapped with V. So i'm filling a ticket here as requested in the Discord to find a better solution before continue working on finishing the bindings.
Additional Information/Context
to install libuing i used
r2pm -ci libuing
V version
V 0.4.8 70112d8
Environment details (OS name and version, etc.)
Huly®: V_0.6-21329
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: