News for hackers. Stuff that matters.
Re:The Swift compiler is slow due to how types are inferred by jiripospisil on Friday June 14, 2024 @06:11AM (#40679342)
Depends on the context but in general Zig wants you to be explicit. Writing 0.0 is fine at comptime or if you're e.g. adding it to an already known float type, but defining a runtime variable (var x = 0.0; ...) will not work because x doesn't have an explicit type (f16, f32, f64, f80, or f128?). In this case, you would need to write "var x: f32 = 0". You could write "var foo = @as(f32, 0)" but that's just a weird way of doing things and probably not what OP meant.

There are no comments on this comment yet.