[perl #127226] QUOTE does not remove backslash with adverb :b

2017-06-23 Thread Zoffix Znet via RT
On Sat, 09 Jan 2016 10:23:18 -0800, gfldex wrote:
> my $x = 42; say Q:s:b{\$x}
> 
> # OUTPUT«\42␤»
> # EXPECTED«42␤»

Worth nothing the OP's expected is not correct. The result should be string 
'$x', as the backslash would escape the sigil and prevent it from being 
interpolated. It actually works right-er when using `q` instead of `Q` quoter, 
but the backslash remains unremoved:

m: my $x = 42; say q:s:b{\$x}
rakudo-moar 4a37de: OUTPUT: «\$x␤»
m: my $x = 42; say Q:s:b{\$x}
rakudo-moar 4a37de: OUTPUT: «\42␤»


[perl #127226] QUOTE does not remove backslash with adverb :b

2017-06-23 Thread Zoffix Znet via RT
On Sat, 09 Jan 2016 10:23:18 -0800, gfldex wrote:
> my $x = 42; say Q:s:b{\$x}
> 
> # OUTPUT«\42␤»
> # EXPECTED«42␤»

Worth nothing the OP's expected is not correct. The result should be string 
'$x', as the backslash would escape the sigil and prevent it from being 
interpolated. It actually works right-er when using `q` instead of `Q` quoter, 
but the backslash remains unremoved:

m: my $x = 42; say q:s:b{\$x}
rakudo-moar 4a37de: OUTPUT: «\$x␤»
m: my $x = 42; say Q:s:b{\$x}
rakudo-moar 4a37de: OUTPUT: «\42␤»


Re: [perl #131626] [PERF] ≥ and ≤ are 36x slower than Texas version; ≠ is 15x slower

2017-06-23 Thread Elizabeth Mattijsen
Temporarily fixed with a13bad95b2e1ad48a1d1a

> On 22 Jun 2017, at 22:59, Aleks-Daniel Jakimenko-Aleksejev via RT 
>  wrote:
> 
> This was discussed in
> https://github.com/rakudo/rakudo/pull/1032#issuecomment-284217342
> 
> In theory, this ticket should apply for other ops as well.
> 
> Note that I said that I will change the way unicode ops are implemented, but I
> didn't have much time since then. Hoping to get to it at some point.
> 
> On 2017-06-22 10:29:59, c...@zoffix.com wrote:
>> I'd expect the fancy Unicode versions of <=, >=, and != to perform
>> equally well, instead the
>> ≥ and ≤ are 36x slower than their Texas companions and ≠ is 15x
>> slower.
>> 
>> Here's the timings for >= vs ≥:
>> 
>> m: my $x = rand; for ^1000_000 { $ = $x >= 1_000_000_000_000 }; say
>> now - INIT now;
>> rakudo-moar 43c176: OUTPUT: «0.74663187␤»
>> m: my $x = rand; for ^1000_000 { $ = $x ≥ 1_000_000_000_000 }; say now
>> - INIT now;
>> rakudo-moar 43c176: OUTPUT: «(timeout)»
>> m: my $x = rand; for ^1000_0 { $ = $x ≥ 1_000_000_000_000 }; say now -
>> INIT now;
>> rakudo-moar 43c176: OUTPUT: «0.2661272␤»
>> m: say 0.2661272*100 / 0.729002
>> rakudo-moar 43c176: OUTPUT: «36.505689␤»


Re: parameters from the command line: how do they do that?

2017-06-23 Thread ToddAndMargo

On 06/21/2017 11:03 PM, Brandon Allbery wrote:


On Thu, Jun 22, 2017 at 1:51 AM, Todd Chester > wrote:


You want named parameters.

 sub MAIN(:$fixed-string, :$extended-regex, ...) {
   # $fixed-string and $extended-regex are Bools here,
   # True if the corresponding option specified
 }

You should recognize this as being similar to named parameters
work for
normal Perl 6 functions, but MAIN exposes them to the command
line like
GNUish long options.


What does the ":" do?  and does it give you back the
value associated with it, if there is one?


I guess that means you did not recognize colon-pair syntax for named 
parameters.


https://docs.perl6.org/language/terms#Pair see at the end for their use 
as named parameters.


Since I assume I'm going to have to read that link for someone on the 
list anyway:


:name(value)
:name
:name
:!name
:$name

are all colon-pairs. When used as parameters, they indicate named (as 
opposed to positional) parameters.


The first form allows you to associate any variable name with the 
parameter name, optionally with a type. The second form is always a 
String (and any of the bracketing String forms can be used, e.g. 
:foo<> --- but *not* :foo"bar"; that would need to use the first 
form). The final three are always Bools; the last one takes the 
parameter name from the variable name.




Thank you!

I have some reading/learning to do.


Re: parameters from the command line: how do they do that?

2017-06-23 Thread ToddAndMargo

On 06/22/2017 07:27 AM, Bruce Gray wrote:



On Jun 21, 2017, at 11:49 PM, Todd Chester  wrote:

Hi All,

I know how to read things on the command line.  But
how to other's figure out what goes together when things
don't arrive in order?


—snip—

Along with the fine docs that have been recommended, I offer this just-uploaded 
video:

https://www.youtube.com/watch?v=D16wa-gnFwE
Brian Duggan - "Extending Perl 6 Command Line Argument Parsing using 
Metaprogramming”

Brian covers the basics of “positional vs named parameters” around timemark 
6m45s to 8m15s.

—
Hope this helps,
Bruce Gray (Util of PerlMonks)



I will check it out.  Thank you!


[perl #131639] [BUG] Junction:D.iterator returns an iterator that .pulls-one a Mu type object

2017-06-23 Thread via RT
# New Ticket Created by  Zoffix Znet 
# Please include the string:  [perl #131639]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=131639 >


Originally found this in behaviour of Z meta operator:

 m: dd .any Z .any
 rakudo-moar 10f840: OUTPUT: «((Mu, Mu),).Seq␤»

Which works fine with X metaoperator:

 m: dd .any X .any
 rakudo-moar 10f840: OUTPUT: «((any("a", "b", "c"), any("d", "e", 
"f")),).Seq␤»

I dug a bit and found the cause to be in Any.iterator:

 m: dd Seq.new: any('x').iterator
 rakudo-moar 10f840: OUTPUT: «(Mu,).Seq␤»

But after that I lost the trail and unsure where the bug is hiding...


[perl #131640] Unterminated qw subscript should say the line number where it was started ( say “$

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


Let's say you have this code:

my $x;

say “$x<”;

my %h = ;
for %h.kv -> $k, $v {
say “$k $v”
}



The error message you will get:

===SORRY!=== Error while compiling -e
Variable '$k' is not declared
at -e:6
--> for %h.kv -> ⏏$k, $v {


In a way, this is understandable. I don't know if it is possible to print 
something better in this case.

However, let's say you realize what is happening. The issue, obviously, is 
somewhere above the line where you are getting in the error message. In theory, 
if you delete everything on that line and onwards, the error message would 
complain about unclosed something, and this will lead the developer to the line 
which causes the problem.

So let's try it.

Code:

my $x;

say “$x<”;

my %h = ;


Result:
Unable to parse quote-words subscript; couldn't find right angle quote
at -e:6
--> ⏏
expecting any of:
postfix


It says “couldn't find right angle quote” but does not say where the left angle 
quote was.

It should say “couldn't find right angle quote (corresponding left angle quote 
was at line X)”. We already have this kind of thing for other unclosed things 
(e.g. #`{{{ )


Re: parameters from the command line: how do they do that?

2017-06-23 Thread Bruce Gray

> On Jun 21, 2017, at 11:49 PM, Todd Chester  wrote:
> 
> Hi All,
> 
> I know how to read things on the command line.  But
> how to other's figure out what goes together when things
> don't arrive in order?

—snip—

Along with the fine docs that have been recommended, I offer this just-uploaded 
video:

https://www.youtube.com/watch?v=D16wa-gnFwE
Brian Duggan - "Extending Perl 6 Command Line Argument Parsing using 
Metaprogramming”

Brian covers the basics of “positional vs named parameters” around timemark 
6m45s to 8m15s.

— 
Hope this helps,
Bruce Gray (Util of PerlMonks)