develooper Front page | perl.perl5.porters | Postings from November 2016

Re: RFC: core sub signature introspection

Thread Previous | Thread Next
November 24, 2016 22:59
Re: RFC: core sub signature introspection
Message ID:
Sam Kington wrote:
>Surely this is backwards? If anything, the fact that a sub's parameters
>can be introspected makes it *easier* to change them, because you can
>expect (some of) the code calling that sub to introspect the required
>parameters and adjust its own behaviour accordingly, rather than
>hard-coding which parameters it supplied?

You're imagining a rather bizarre situation here.  You're supposing a
change being made to the sub's calling interface that we would normally
regard as an incompatible API change.  We do not generally expect calls
to a sub to change between versions of the sub.  If you do expect them
to change, based on metadata supplied with the sub, that would amount to
a very strange API.

Your "some of" exposes a problem.  If the calling interface does vary
in this way, it would require *all* call sites to pay attention to the
metadata that says which parameter goes where.  No hard-coded call would
be safe.

>But I don't see how it would be actively harmful.

To have such a bizarre API wouldn't really be actively harmful, it would
just be an awful hassle to use.  But that is not the situation that we
were discussing.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About