Redundant type expressions in field declarations

i have a generic function that returns a struct, which in turn implements an init(...) method… typical use looks like this:

var foo = GenType(u8).init(...);
var bar = GenType(bool).init(...);

if i define my own struct with fields (not decls), i find i have to repeat the type expression on both sides of the =

struct {
    foo: GenType(u8) = GenType(u8).init(...),
    bar: GenType(bool) = GenType(bool).init(...),

is there a more concise way of saying this???

Not currently, but in the future there might be if Proposal: Decl Literals · Issue #9938 · ziglang/zig · GitHub gets accepted and implemented, which would enable

struct {
    foo: GenType(u8) = .init(...),
    bar: GenType(bool) = .init(...),
1 Like