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

Re: Announcing Perl 7 Perl5 Porters <perl5-porters@perl.org>

Thread Previous | Thread Next
From:
Kent Fredric
Date:
July 1, 2020 18:29
Subject:
Re: Announcing Perl 7 Perl5 Porters <perl5-porters@perl.org>
Message ID:
CAATnKFA7YANPDD9f4Y_tsxAMjX05p_YdM=NoLtdkviia4QgZKQ@mail.gmail.com
On Thu, 2 Jul 2020 at 00:37, Todd Rinaldo <toddr@cpanel.net> wrote:
> Example: Something that fixes indirect object notation automagically.
>
> Todd

I think you're forgetting prototypes are a thing, and you can't tell
if it's indirect or not, without consulting the prototype.

-------
#!perl
use strict;
use warnings;

{
  package Evil::Module;
  sub new {
    return "Hahaha";
  }
}
sub new(*;@) {
  sprintf "%s->(%s)\n", $_[0], join q[,], @_[1..$#_] ;
}

my $v = new Evil::Module,(qw(Hi Guys));

print $v;

--------------------

You take away the "sub new" with the "*" prototype declared on it, and
it reverts to being indirect.

Good luck parsing that.

-- 
Kent

KENTNL - https://metacpan.org/author/KENTNL

Thread Previous | 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