develooper Front page | perl.perl5.porters | Postings from June 2020

Re: Announcing Perl 7

Thread Previous | Thread Next
David Mertens
June 26, 2020 14:04
Re: Announcing Perl 7
Message ID:

If my suggestion for the behavior of "use v5.32" are considered good, then
this should work under either 5.32 or 7:

use v5.32;
sub say_it ($) {say $_[0]; "foo" }

my @result = say_it 5, 6;
say "result is @result";

Amusingly, this is *not* giving me what I expect in my current Perl version
(5.30). I was expecting "5\nresult is foo 6" but I get "5\nresult is foo".

My own misunderstandings about prototypes aside, I think the above is
pretty easy. :-)

David (Mertens)

On Fri, Jun 26, 2020 at 9:46 AM Dave Mitchell <> wrote:

> On Fri, Jun 26, 2020 at 02:49:31PM +0200, demerphq wrote:
> > To achieve this change requiring new code to include "use v7" is a
> > non-starter.
> This is the bit I fundamentally don't understand. Convince me of this,
> and most of my objections will fizzle away.
> In my world, the big first public release of 7.0.0 will come along with
> lots of explanations and docs all saying that "if you are writing modern
> perl, then the first thing you need to do is add 'use v7;' to the top of
> your script" - in the same way that 'use strict; use warnings' has been
> the mantra for the last 20 years.
> People learning perl for the first time will know nothing other than to
> add 'use v7'. People working for big companies with coding standards
> will be told to put 'use v7' at the top of each script.
> Meanwhile, people's existing code which doesn't have a 'use vx.y.z' at
> the top won't gratuitously break right now.
> There is nothing to stop us from, in 5 years say, making the latest
> release of of perl putting out an automatic warning along the lines of
>     warning: this script doesn't include a 'use vx.y.z'
> header, then some time later making it fatal.
> Then there's nothing to stop a later release of perl from croaking
> if the vx.y.z  doesn't match some minimum we've decided.
> There's nothing to stop us in X years time that saying the next release of
> perl won't support indirect object syntax or whatever.
> In short, lets break things as and when there's a good reason to do so,
> rather than break things gratuitously.
> As a simple example of the problems enabling stuff by default causes,
> here's a little challenge. Write a short script which uses a subroutine
> with a prototype. That script must run on both vanilla 5.32.0 and 7.0.0
> (by vanilla I mean a perl installation with only the modules installed
> that come bundled with perl itself).
> Was that easy?
> --
> This email is confidential, and now that you have read it you are legally
> obliged to shoot yourself. Or shoot a lawyer, if you prefer. If you have
> received this email in error, place it in its original wrapping and return
> for a full refund. By opening this email, you accept that Elvis lives.

 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

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