Replies: 1 comment 8 replies
-
After a bit more experience with Zig and working with zfltk, I have found the separation of types within objects that do very similar things to be a little clunky. I originally pushed that change, but I believe it can be further improved. The main issue stems with working with callbacks and other functionality which takes a specific widget type as a parameter. Consider the following example: groupCb(group: Group(.flex)) void {
}
// Vs
groupCb(group: Group) void {
} To keep the best of both worlds, I can think of two decent solutions: Solution 1: Group.init(.flex, .{
.x = 50,
.y = 50,
.w = 50,
.h = 50,
} Solution 2: Group.init(.{
.kind = .flex,
.x = 50,
.y = 50,
.w = 50,
.h = 50,
} These both against the current syntax: Group(.flex).init(.{
.x = 50,
.y = 50,
.w = 50,
.h = 50,
} Advantages to solution 1:
Disadvantages to solution 1:
Advantages to solution 2:
Disadvantages to solution 2:
Advantages to current solution:
Disadvantages to current solution:
I'd love to hear feedback on this, along with possible arguments to keep the current method |
Beta Was this translation helpful? Give feedback.
-
This is a place to discuss possible improvements and additions to the API, continued from #11
Beta Was this translation helpful? Give feedback.
All reactions