Re:An intro to Zig's integer casting for C programmers
by layer8 on Tuesday May 11, 2021 @03:54PM
(#27122701)
> you can always also write the expected type, if you want.
But you have to read the code of people who didn‘t.
Re:An intro to Zig's integer casting for C programmers
by scoutt on Wednesday May 12, 2021 @04:31AM
(#27128067)
Exactly. Like when you see:
var x = some_function();
What am I dealing with here? mmmmmm....Ok... let's find some_function()... I hope my editor has "go to definition", otherwise "grep -r some_function ."...
Declaring variables with var let's you also write let or const instead, giving the programmer more options (and making those options obvious as well).
You might not "like" type inference, but it really is superior to no-type-inference - you can always also write the expected type, if you want.