Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: Label makes a sub to return empty list -- "secret"? documented?

by Jenda (Abbot)
on Sep 12, 2025 at 11:33 UTC ( [id://11166201]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Label makes a sub to return empty list -- "secret"? documented?
in thread Label makes a sub to return empty list -- "secret"? documented?

Fail in what way? In not producing the exact (save for whitespace) copy of the original code? Is that really a problem? Both the compiled and "deparsed" code would still have to denote that the subroutine isn't returning the value of the statement before the empty return.

Empty return is the only solution that is NOT a syntax trick, therefore it ought to be implemented efficiently and if B::Deparse needs to produce code of a subroutine that returns nothing, the empty return should be the "inferred" solution even if it means that deparsing turns some of those tricks into an explicit empty return.

Jenda
1984 was supposed to be a warning,
not a manual!

  • Comment on Re^5: Label makes a sub to return empty list -- "secret"? documented?

Replies are listed 'Best First'.
Re^6: Label makes a sub to return empty list -- "secret"? documented?
by LanX (Saint) on Sep 13, 2025 at 13:38 UTC
    Yes probably.

    three issues worth mentioning:

    • a) Perl is not that orthogonal to be instantly sure these three variants always do the same thing.
    • b) P5P have bigger fish to fry than such micro optimizations.
    • c) maintaining B::Deparse is neither straightforward nor easy.

    Though if you think it's so important, you can submit a patch to optimize the last return away.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11166201]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2025-11-13 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (68 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.