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

getting signatures out of experimental

Thread Next
From:
Ricardo Signes
Date:
November 21, 2021 21:13
Subject:
getting signatures out of experimental
Message ID:
295be48f-8dc4-495d-be7a-a7326793ce9d@beta.fastmail.com
Porters,

We introduced experimental signatures to the language over six years ago, and they are still experimental, and everybody knows that I would very much like to end this experiment so that we can use signatures in our code without fear of their breakage.  Recently, I've had some conversations with people about whether we can "just remove the experimental flag."  We haven't done so, over the years, because of discussion about making one kind of improvement or another.  Has this been "the perfect is the enemy of the good enough?"  I think to some extent it has, and now the question is "how much good *within easy reach* is good enough?"

That is:  it would be very easy to just remove the flag, and that would be good.  But if it's in our power to make one more really improving change that would have a significant cost later, maybe we should do just that.  But we can't kick the can down the road indefinitely.

I have discussed this proposal a little bit with some people, but I am presenting it as my proposal and not any sort of dictate from the PSC.  Here goes:

*I propose* that as soon as possible, we update signatured subroutines so that…
 1. when a subroutine has a signature, the `@_` variable is not populated when the subroutine is entered
 2. when a subroutine has not set up `@_` on entry, accessing `@_` is a severe runtime warning, reading something like "Accessing @_ in a subroutine that has a signature is meaningless".  (This could be caught sometimes at compile time, and it would be preferable, but not necessary, to do so when possible.)
We ship this in v5.36.0, with no further changes to signatures.  (Any further improvements will come in future RFCs.)  In v5.38.0, *signatures are no longer experimental*.  

With that done, signatures are shipped and basically safe to use on code that uses them quite a ways back, as long as you're sure you didn't look at @_.  Even if you require v5.38.0 in your code to avoid thinking about their behavior over the previous seven years, we'll have shipped stable signatures at long last.

*What serious objects should prevent us from moving forward this way?*

-- 
rjbs
Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About