Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upNormal mechanisms to create a constant do not work on undef #14077
Comments
This comment has been minimized.
This comment has been minimized.
From @demerphqBoth of these subs should be identified as constants by the perl internals, Bug affects at least perl 5.14, and is still present in bleadperl. For some reason constant.pm is able to create constants which are undef. Yves $ perl -MDevel::Peek -le'sub K1 () { undef } sub K2() { 0 } Dump(\&K1); -- |
This comment has been minimized.
This comment has been minimized.
From @cpansproutOn Sun Sep 07 23:33:08 2014, demerphq wrote:
Optimising pp_undef to pp_const when it has no arguments is on my to-do list.
This looks constant to me, or did you mean &PL_sv_undef? $ perl -MDevel::Peek -e 'use constant K1=>undef; Dump \&K1' -- Father Chrysostomos |
This comment has been minimized.
This comment has been minimized.
The RT System itself - Status changed from 'new' to 'open' |
This comment has been minimized.
This comment has been minimized.
From @demerphqOn 8 September 2014 15:32, Father Chrysostomos via RT <
SV = IV(0x7f91f40070c8) at 0x7f91f40070d0
No, I was observing the same point you are here, for some reason constant.pm Yves |
This comment has been minimized.
This comment has been minimized.
From @cpansproutOn Mon Sep 08 09:59:48 2014, demerphq wrote:
Sorry, I misread you. Maybe I should start wearing my glasses at the computer. :-) Fixing this is trivial, but I would appreciate any response to the issue I raised in ticket #35129, since it is related. -- Father Chrysostomos |
This comment has been minimized.
This comment has been minimized.
From @demerphqOn 8 September 2014 21:38, Father Chrysostomos via RT <
Its cool. I could have worded it better anyway.
I responded to the ticket. In short, yes, im opinion you should go ahead Yves -- |
This comment has been minimized.
This comment has been minimized.
From @cpansproutOn Mon Sep 08 06:32:04 2014, sprout wrote:
(I meant OP_UNDEF and OP_CONST.) Except that is not the best approach. A const op needs a slot in the pad under threads, so that would increase memory usage. pp_undef already has an early return for no arguments, so using pp_const instead would probably not speed things up. So I used a different approach. I taught op_const_sv about OP_UNDEF with !op_private in commit 1542cb4. More general constant folding for undef has yet to be done, but this ticket is resolved. (Actually, would folding undef make much difference? Most people have warnings on, so uninit warnings would prevent folding anyway.) -- Father Chrysostomos |
This comment has been minimized.
This comment has been minimized.
@cpansprout - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#122728 (status was 'resolved')
Searchable as RT122728$