|Don't ask to ask, just ask
Re: Introspecting function signaturesby dave_the_m (Monsignor)
|on Mar 05, 2021 at 20:31 UTC
The general feeling was that the signature is an internal implementation detail of the subroutine, and that things outside of a subroutine shouldn't be relying on the ability to inspect it. For example, a sub that's part of a documented API in a CPAN module might, in a new release, switch back from using a signature to "manually" processing @_, because it turns out to be more convenient for achieving some new functionality added to to sub.
Introspection of the initial opcodes in a sub is fragile, and might break in new releases of perl. It won't work at all prior to 5.26, which introduced the argcheck/argelem/argdefelem ops, and the structure of the optree changed in 5.30. And (assuming I get my perl core mojo back at some point), there will be large changes happening to signatures in the future, reflected by big changes in the opcodes. And further changes when optimisation is added.