Perl 7 Thoughts

Overall, I think the Perl 7 announcement is great news.

I only have one small objection:

One of the proposed changes is to remove

Perl 4-style prototype definitions (use :prototype() instead)

My objection to this is that :prototype was only introduced in Perl 5.20. Code using it won't work as expected on older versions of Perl.

The wording of this proposed change mischaracterizes the older sub prototype syntax as something Perl-4-specific, whereas the reality is that up until Perl 5.20, it was the way to declare prototypes.

This means that if I want my code to support Perl 7, I need to abandon Perl 5.18 and below, or jump through some fairly ugly hoops.

I don't like that.

4 Comments

It's a bit worse than that. Since v5.30 (and v5.26, but not v5.28) mandates the escape of the left brace in a pattern, your v5.32/v7 code has to comply with that.

I recently updated my Object::Iterate module to use :prototype. I'm likewise sad about bumping the requirement up to 5.20, but there's black magic eval stuff I could do to support 5.008. I don't know if I like that those.

And thanks for the correction on prototypes. Those were never a Perl 4 thing. Total lapse on my part. No one told me to say that and I completely made it up. We're correcting the announcement.

Worse yet, the `set_prototype` has to happen in a `BEGIN` block to take full effect :-/

Leave a comment

About Toby Inkster

user-pic I'm tobyink on CPAN, IRC and PerlMonks.