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

Re: PSC #034 2021-08-20 - "Namespaces Special"

Thread Previous | Thread Next
From:
Yuki Kimoto
Date:
August 30, 2021 08:02
Subject:
Re: PSC #034 2021-08-20 - "Namespaces Special"
Message ID:
CAExogxNc5esi2U1EhQUBoLwjD=vKLUW8a1tJaQSRUx1fsyf8GQ@mail.gmail.com
2021-8-30 14:12 Dan Book <grinnz@gmail.com> wrote:

> On Mon, Aug 30, 2021 at 1:09 AM Yuki Kimoto <kimoto.yuki@gmail.com> wrote:
>
> Imported symbols override builtins already, this is how modules like
> autodie and Time::HiRes work. But yes, this chance of collision is
> unavoidable and we have to take more care with more common names.
>
> -Dan
>

> Imported symbols override builtins already

Is this really?

  perl -E 'sub substr { print "substr\n" }; substr();'

Output

  Not enough arguments for substr at -e line 1, near "substr()"
  Execution of -e aborted due to compilation errors.

Imported symbols don't seem to override CORE::substr,

Although the following is OK.

  perl -E 'sub substr { print "substr\n" }; &substr();'

Output

  substr

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