(found in the Pugs testsuite.)
my $undef = undef;
say $undef.chars? # 0? undef? die?
say chars $undef; # 0? undef? die?
I'd opt for "undef.chars" to be an error ("no such method") and "chars
undef" to return 0 (with a warning printed to STDERR^W$*ERR).
Opinions?
--Ingo
--
Linux, the choice of a GNU | When cryptography is outlawed, bayl bhgynjf
generation on a dual AMD | jvyy unir cevinpl!
Athlon! |
Well, I think that "chars $undef" should be exactly equivalent to
"$undef.chars". In fact, I think it is: "chars $undef" is just the
indirect object form.
So perhaps "method not found" errors "fail" instead of "die".
Luke
Didn't $Larry rule that method calls on undef return undef, for the
same reason array and hash subscripting does?
--
Brent 'Dax' Royal-Gordon <br...@brentdax.com>
Perl and Parrot hacker
Um, by default, that's exactly what fail does. I don't think it's
a problem for it to die under "use fatal", since that's saying you
prefer an exception model in general.
Larry