Hello, this is my very first post. I’ve been a casual reader, and the community seems welcoming.
(sorry for moving it around, I guess it should be on Explain, i’ll leave it here, if I’m wrong somebody please move to the correct location)
I’m learning Zig on my spare time… One thing that’s been confusing is the overuse of the dot.
- Field/member access:
engine.health - Explicit pointer dereferencing:
engine.*.health - Pointer-to-struct field access:
engine.health(instead ofengine.*.health, or a different notationengine->health) - Struct field initializer:
DroneEngine{ .health=100 }; - Enum literal:
var status: EngineStatus = .off - Anonymous struct literal:
const x = .{ .foo = 123, }; - Anonymous enum:
const value: MyUnion = .{ .foo = 123 }; - Ranges:
0..engines.len - Method call:
engine.toggle()
What I’m saying could be wrong, if so I appreciate tips on how to best use it. But in general seems like “.” means too many different things and could be replaced by another notation in some cases?
Thanks.