Today around 12:19pm, Nathan Torkington hammered out this masterpiece:
: Casey R. Tweten writes:
: > Ok, consider allowing:
: >
: > $a = length @b;
: >
: > to DWIM, however, when running with warnings, warn the user that C<scalar> is
: > what they really want.
: >
: > Just thowing that out there.
:
: Good idea, but I think it's a bad move to turn warnings into style
: guides. Warnings should point out things that have unexpected
: consequences ("you seemed to think that value was defined, but it
: wasn't", "that parenthesis after the function name is interpreted as
: starting the argument list, but you put whitespace between the
: function name and the parenthesis--you're not thinking the parentheses
: are giving you a term in a larger expression, are you?"). They should
: be things that you pay attention to because your program is probably
: wrong.
:
: Turning Perl into a nagging harpie means that the really important
: warnings will be ignored.
:
: This line of thinking brought to you by Mark-Jason's excellent talk
: on data typing.
I agree with this line of thinking, however, I suppose I don't agree with
implementing length in this way since we already have C<scalar>.
In that light, if C<length> is to replace scalar for, we'll say, LISTs, then
lets remove C<scalar> since it will be effectivley defunct.
Using length like will DWIM when a beginning perl hacker sits down after
learning C or JavaScript or Java or [ fill in the blank ].
--
print(join(' ', qw(Casey R. Tweten)));my $sig={mail=>'[EMAIL PROTECTED]',site=>
'http://home.kiski.net/~crt'};print "\n",'.'x(length($sig->{site})+6),"\n";
print map{$_.': '.$sig->{$_}."\n"}sort{$sig->{$a}cmp$sig->{$b}}keys%{$sig};
my $VERSION = '0.01'; #'patched' by Jerrad Pierce <belg4mit at MIT dot EDU>