[perl #131120] [BUG] Junctions don't autothread some methods correctly

2017-04-22 Thread fernandocor...@gmail.com via RT
Em Fri, 07 Apr 2017 10:49:02 -0700, c...@zoffix.com escreveu:
> Some methods don't seem to get autothreaded correctly. Str does have
> .Numeric, but when junctioned, it doesn't seem to be reachable:
> 
> 
> $ perl6 -e 'say any("42",42).Int'
> any(42, 42)
> 
> $ perl6 -e 'say any("42",42).Numeric'
> Cannot resolve caller Numeric(Str: ); none of these signatures match:
> (Mu:U \v: *%_)
> in block  at -e line 1
> 
> $ perl6 -e 'say any("42",42).Real'
> Cannot resolve caller Real(Str: ); none of these signatures match:
> (Mu:U \v: *%_)
> in block  at -e line 1
> 
> $ perl6 -e 'say "42".Numeric'
> 42
> 
> $ perl6 -e 'say "42".Real'
> 42
> 
> $ perl6 -v
> This is Rakudo version 2017.03-153-gb1e7a01 built on MoarVM version
> 2017.03-87-g5d73bf4
> implementing Perl 6.c.


That's not problem only on Int:

$ ./perl6 -e 'say any(42, 42.0).Numeric'
Cannot resolve caller Numeric(Int: ); none of these signatures match:
(Mu:U \v: *%_)
  in block  at -e line 1

$ ./perl6 -e 'say any(42.0, 42).Numeric'
Cannot resolve caller Numeric(Rat: ); none of these signatures match:
(Mu:U \v: *%_)
  in block  at -e line 1


[perl #131123] [BUG] Useless use of useless use in smartmatch + block + try

2017-04-22 Thread fernandocor...@gmail.com via RT
Em Fri, 14 Apr 2017 14:12:54 -0700, fernandocor...@gmail.com escreveu:
> Em Fri, 07 Apr 2017 19:59:42 -0700, c...@zoffix.com escreveu:
> >
> >  m: say so 42 ~~ { try $_ == 5 }
> >  rakudo-moar af50e0: OUTPUT: «WARNINGS for :␤Useless
> > use
> > of "==" in expression "$_ == 5" in sink context (line 1)␤False␤»
> >
> >  m: say so 42 ~~ { $_ == 5 }
> >  rakudo-moar af50e0: OUTPUT: «False␤»
> 
> 
> I think the problem is only with block + try...
> 
>  m: say {try 5 == 5}()
>  combined, experimental evalbot rakudo-moar 7f73f9: OUTPUT:
> «WARNINGS for :␤Useless use of "==" in expression "5 == 5" in
> sink context (line 1)␤True␤»

try with a block doesn't warn:

 Fernando Corrêa de Oliveira m: say {try {5 == 5}}()
<•camelia> combined, experimental evalbot rakudo-moar 624fe8: OUTPUT: «True␤»


[perl #67046] [PATCH] - implemented: not Object's method, and sign Num's method

2009-06-29 Thread fernandocor...@gmail.com (via RT)
# New Ticket Created by  fernandocor...@gmail.com 
# Please include the string:  [perl #67046]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=67046 


implemented:
- not Object's method
- sign Num's method

Thats my first time to send a patch, I don't know if its OK, but I really
want to help.
Thanks

-- 
Just another Perl Hacker,
Fernando (SmokeMachine)
http://perl-e.org
From 8d90f2ee17a1171a5a3e0972d018af123fb20fdb Mon Sep 17 00:00:00 2001
From: Fernando Correa de Oliveira fernandocor...@gmail.com
Date: Mon, 29 Jun 2009 02:04:35 -0300
Subject: [PATCH] not method added

---
 src/setting/Object.pm |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/setting/Object.pm b/src/setting/Object.pm
index ec0b45e..66d3e29 100644
--- a/src/setting/Object.pm
+++ b/src/setting/Object.pm
@@ -73,6 +73,10 @@ class Object is also {
 
 return @methods;
 }
+method not() {
+return !?self;
+}
 }
 
+
 # vim: ft=perl6
-- 
1.5.4.3

From 70b3210c52bc85c1539ca26541b159cec21a8b55 Mon Sep 17 00:00:00 2001
From: Fernando Correa de Oliveira fernandocor...@gmail.com
Date: Mon, 29 Jun 2009 04:07:01 -0300
Subject: [PATCH] sign method added to Num class

---
 src/setting/Num.pm |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/setting/Num.pm b/src/setting/Num.pm
index 157d18f..338656b 100644
--- a/src/setting/Num.pm
+++ b/src/setting/Num.pm
@@ -256,4 +256,8 @@ class Num is also {
 };
 self!from-radians($r, $base)
 }
+
+our Int multi method sign ( Num $x: ) is export {
+return $x = 0;
+}
 }
-- 
1.5.4.3