3 ms·
Those mean different things. f(.{}) is calling a function, which takes a struct, using an in-place constructor which provides the default arguments for the nec
by samatman 2y ago
Those mean different things.
f(.{}) is calling a function, which takes a struct, using an in-place constructor which provides the default arguments for the necessary struct type.
f({}) is passing an instance of `void` to a function with a `void` type parameter. Do you need to do this, specifically? No. But you can.
fn voidPass(v: void) void {
_ = v;
}
test "void pass" {
voidPass({});
}
- kristoff_it 2y agoYou do need to pass a void value if you use a hashmap as a set (eg StringHashMap(void)) Adding an entry requires you to pass a void value: map.put("hi", {});