|
|
|
|
|
by mananaysiempre
330 days ago
|
|
It turns out[1] that v-strings are strings. So v102.111.111 is a three-character string containing codepoints decimal 102 (f), 111 (o), 111 (o), and v128513 is a one-character string containing codepoint decimal 128513 (U+1F601 GRINNING FACE WITH SMILING EYES). ... Yeah, I don’t know who thought this was a good idea either. I mean, I know versions sort lexicographically and strings do too, but no. Bonus points: > If there are two or more dots in the literal, the leading v may be omitted. So 1 and 1.1 denote numbers, but 1.1.1 and 1.1.1.1 denote strings. I guess there’s a sort of syntactic pun to be had with IPv4 addresses. Still, no. Bonus bonus points: > Note that since Perl 5.8.1 the single-number v-strings (like v65) are not v-strings before the => operator (which is usually used to separate a hash key from a hash value); instead they are interpreted as literal strings ('v65'). So v1 always denotes a string, but which string it denotes is context-dependent. [1] https://perldoc.perl.org/perldata#Version-Strings |
|
It's not so much weakly typed as randomly typed.