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