[perl #130231] [LTA] Nil.chrs complains about the use of Nil in numeric context, but isn't it a string context? (Nil.chrs)

2016-12-02 Thread Zoffix Znet via RT
On Thu, 01 Dec 2016 15:11:31 -0800, alex.jakime...@gmail.com wrote:
> Code:
> Nil.chrs
> 
> Result:
> Use of Nil in numeric context
>   in block  at -e line 1
> 
> 
> At the same time:
> 
> Code:
> Nil.ords
> 
> Result:
> Use of Nil in string context
>   in block  at -e line 1
> 
> 
> I think that both should say that it is in string context.


.chrs takes a list of numbers. The Nil is used in numeric context, resulting in 
a 0, which after being .chr'ed results in a null string:

m: quietly say Nil.chrs eq "\x[0]"; # True
rakudo-moar abc643: OUTPUT«True␤» 

The warning is accurate.


[perl #130231] [LTA] Nil.chrs complains about the use of Nil in numeric context, but isn't it a string context? (Nil.chrs)

2016-12-02 Thread Will Coleda via RT
On Thu, 01 Dec 2016 15:11:31 -0800, alex.jakime...@gmail.com wrote:
> Code:
> Nil.chrs
> 
> Result:
> Use of Nil in numeric context
>   in block  at -e line 1
> 
> 
> At the same time:
> 
> Code:
> Nil.ords
> 
> Result:
> Use of Nil in string context
>   in block  at -e line 1
> 
> 
> I think that both should say that it is in string context.


chrs takes an array of Ints and returns a Str; it's trying to use Nil in a 
numeric context to get a number to work with.

ords takes a Str and returns an array of ints - it's trying to use Nil in a 
string context to get character to work with.

Seems fine. Rejecting ticket.

-- 
Will "Coke" Coleda


[perl #130231] [LTA] Nil.chrs complains about the use of Nil in numeric context, but isn't it a string context? (Nil.chrs)

2016-12-01 Thread via RT
# New Ticket Created by  Aleks-Daniel Jakimenko-Aleksejev 
# Please include the string:  [perl #130231]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=130231 >


Code:
Nil.chrs

Result:
Use of Nil in numeric context
  in block  at -e line 1


At the same time:

Code:
Nil.ords

Result:
Use of Nil in string context
  in block  at -e line 1


I think that both should say that it is in string context.