|
|
|
|
|
by hoytech
3128 days ago
|
|
Most of these design decisions are very useful and pragmatic, and not everyone regards them as "crappy". Additionally, there are several misleading statements in your post. I expect you are aware of the following but just for the record: > - pervasive global state (`$_` and friends); Perl uses dynamic scoping (https://en.wikipedia.org/wiki/Scope_(computer_science)#Dynam...) when setting $_ and friends. For example: $ perl -E '$_ = "A"; say; say for ("B", "C"); say;'
A
B
C
A
For me, dynamic scoping (and, relatedly, RAII) is sorely missed in languages that don't have it. (Although I do agree about $a/$b in sort -- that's a language wart, but not too bad in practice)> - autovivification: a single read by key from a hash is enough to actually create this key; Not true: $ perl -MData::Dumper -e 'my $h = {}; $h->{a}; print Dumper($h)'
$VAR1 = {};
You need to read it as a hash or array reference for it to autovivify: $ perl -MData::Dumper -e 'my $h = {}; $h->{a}->{b}; print Dumper($h)'
$VAR1 = {
'a' => {}
};
Autovivification is another feature that I miss in languages that lack it.Your points about the perl5 implementation are definitely accurate, although I suspect a lot of language implementations have their own dirty laundry as well. :) |
|