Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^2: Does Go steal from Perl? :-)by kikuchiyo (Hermit) |
on Aug 03, 2018 at 20:05 UTC ( [id://1219842]=note: print w/replies, xml ) | Need Help?? |
There are some dangerous misconceptions in this analysis. Go is a strongly and explicitly typed language. There is no such thing as an undefined value and there is certainly no such thing as a numeric context. Instead, every variable has a well-defined, fixed type, specified (or inferred) when the variable is declared, and every type has a well-defined zero value, that is, any variable not explicitly assigned to will be initialized to the zero value of its type. Let's look at the first line then:
In turn, the counts[input.Text()]++ line can be analyzed as follows:
It is likely that the authors of go recognized the code in question as a common idiom and wrote the language standard with it in mind, but the details explained above make it clear that the underlying concepts are rather different from those of Perl.
In Section
Meditations
|
|