develooper Front page | perl.perl5.porters | Postings from January 2012

[perl #24482] 5.8.2: sort CORE::keys() results in subroutine in sort

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
January 10, 2012 13:42
Subject:
[perl #24482] 5.8.2: sort CORE::keys() results in subroutine in sort
Message ID:
rt-3.6.HEAD-14510-1326231753-928.24482-15-0@perl.org
On Sun Nov 16 09:10:38 2003, rafael wrote:
> James Jurach (via RT) wrote:
> > 
> >  $ perl -we '%a=(a=>"b"); print((sort CORE::keys(%a)),"\n")'
> >  Undefined subroutine in sort at -e line 1.
> > 
> >  $ perl -we '%a=(a=>"b"); print((sort keys(%a)),"\n")'
> >  a
> 
> This is due to two facts :
> 
> - perl will parse "sort foo(...)" and "sort(foo ...)" as "sort foo ..."
>   In other words, it doesn't take the parens into account
> - perl parses CORE::keyword as a subroutine, not as the corresponding
>   keyword.
> 
> Fixing this would probably break backward incompatibility in
> undesirable ways.

How would that break compatibility?  Who is currently putting custom
subroutines in the CORE:: namespace?

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: stalled
https://rt.perl.org:443/rt3/Ticket/Display.html?id=24482

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