const x = 42 means x would implicitely be of type comptime_int, same with comptime var x = 42;. So with explicit typing it would be const x: comptime_int = 42;. I like that zig infers the type in those cases.
I think the var thing: Thing = .init(args) is currently tbe preferred way, but it has one huge flaw: when you need to catch the init error, then it is imposdible to use. Which makes me very sad any time it happens to me.
agree with everyone I much prefer var foo : Foo = .init(); but it’s annoying when the thing has error, I also like the var foo : Foo = .default or .empty pattern looks really clean
To TL:DR the link, I use x = .unique_name(...)a lot
.one_way_delay_mean = .ms(250),
But it is literally called init, then I always spell it full:
self.clock = Clock.init(...);
The reason is that the lines where you create a new instances of thing are fewer and more important that the lines where you mutate or read thing. I like to find those critical lines with a dumb text search.
That is exactly why I ran / run into doubts: dumb text search on .init() is useless. If you want to find all places where a certain thing is initialized you have to have some unique personal way identifying these places.