This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add &CORE::undef
authorFather Chrysostomos <sprout@cpan.org>
Sun, 13 May 2012 02:05:24 +0000 (19:05 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 29 May 2012 16:36:27 +0000 (09:36 -0700)
commit46bef06f0f3d8f94283e79e8c77eb5bf23d08fc3
tree568f32ac93490666de55137f59b7a9460c5c66a6
parentd80ed30335f69d8f833d3a3facade69b4f16cd2c
Add &CORE::undef

In the error message, we can’t say ‘&CORE::undef operator’, so we
should be using the op name, rather than the op description.

Instead of using OP_NAME(PL_op->op_next), which would expand to

    PL_op->op_next->op_type == OP_CUSTOM
? XopENTRY(Perl_custom_op_xop(aTHX_ PL_op->op_next), xop_name)
: PL_op_name[PL_op->op_next->op_type]

we can simply use PL_op_name[opnum], which should be quicker.

pp_undef can already handle nulls on the stack.

There is one remaining problem.  If &CORE::undef(\*_) is called, *_
will be undefined while @_ is localised during the sub call, so it
won’t have the same effect as undef *_.  I don’t know whether this
should be considered a bug or not, but I could solve it by making
pp_undef an XSUB.
gv.c
pp.c
t/op/coreamp.t
t/op/coresubs.t