Am creating some types and generate struct with function with default types and then crate a @Struct with it, in Positional.zig I have a GenerateOptiond which seems to have a well define struct but, in Command.zig fails telling that is not a well defined struct.
Sorry for just skimming thru the code really fast, but do you need to pass your Self as pointer?
It makes it a bit hard to track the changes of the types.
I think so,
It could be by value but it would not possible to modify or add the the arrays, so I need to copy that again inside the function and modify it need to return it to reassing it later
That is because it the struct inside has a defualt value of an empty string, that is what I want, but when i insert something different than a empty string the same happens.
src/Command.zig:173:27: error: comptime dereference requires 'Command.GenerateOption("When"[0..4])' to have a well-defined layout
self.options.attrs[0..self.options.attrs.len],
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/Command.zig:50:12: note: struct declared here
return struct { desc: []const u8 = desc };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.zig:56:45: note: called at comptime here
const commandGenerate = command.Generate();
~~~~~~~~~~~~~~~~^~
I am unsure why comptime dereference requires a well defined layout (because the compiler should know whatever layout it picks), but you could try to use a extern struct for GenerateOption.
The compiler is complaining that Self is not an extern or packed struct, and you’re dereferencing it. If you pass it by value instead of pointer, it should work.