> > Especially the case of "var person int", how is it cleaner than "var person int = 0"'
> Because they're equivalent. There no uninitialized values in Go; everything not given an explicit initializer is zeroed out.
Using equivalence is often regarded as less clean.
Because it relies on the reader to be familiar with language-specific quirks. Even if they are, it adds a touch of cognitive overhead until it's become habitual.
In a language like Go, I think the performance will be identical in both cases because it has a basic data flow optimiser.
I program a lot in Perl5 too, and like you, I tend to favour the built-in support for things. I also really recommend the "experimental" function signatures, which make it read a lot more like other languages, and removes boilerplate. However, for better or worse, performance matters in some things I write, and Perl5's optimiser doesn't bother with much dataflow optimisation (improving the interpreter seems to have stalled for decades). So when performance matters, I do write things like 'my $x;' instead of 'my $x = undef;', relying on familiar equivalences. I would prefer the interpreter made them identical so I could state the intent more clearly without penalty, especially because performance-sensitive code tends to be difficult algorithms where clarity is more important.
> Because they're equivalent. There no uninitialized values in Go; everything not given an explicit initializer is zeroed out.
Using equivalence is often regarded as less clean.
Because it relies on the reader to be familiar with language-specific quirks. Even if they are, it adds a touch of cognitive overhead until it's become habitual.
In a language like Go, I think the performance will be identical in both cases because it has a basic data flow optimiser.
I program a lot in Perl5 too, and like you, I tend to favour the built-in support for things. I also really recommend the "experimental" function signatures, which make it read a lot more like other languages, and removes boilerplate. However, for better or worse, performance matters in some things I write, and Perl5's optimiser doesn't bother with much dataflow optimisation (improving the interpreter seems to have stalled for decades). So when performance matters, I do write things like 'my $x;' instead of 'my $x = undef;', relying on familiar equivalences. I would prefer the interpreter made them identical so I could state the intent more clearly without penalty, especially because performance-sensitive code tends to be difficult algorithms where clarity is more important.