[perl #130540] [BUG] || && and or cannot be "overloaded"

2017-01-10 Thread Zoffix Znet via RT
On Tue, 10 Jan 2017 16:23:18 -0800, fernandocor...@gmail.com wrote:
> If I write another || operator it will continue to use the original
> version.
> 
> https://irclog.perlgeek.de/perl6/2017-01-10#i_13895823
> 

To save other readers sifting through the chan log... Even an only sub doesn't 
take root:

 m: sub infix:<||> ($, $) {"hi"}; say 42 || 55
 rakudo-moar 9a11ea: OUTPUT«42␤»

This applies to &&, and, or, and I'd guess any shortcurcuiting operator.


[perl #130494] [CONC] [PERF] Using Proc::Async with tap leads to memory leak

2017-01-10 Thread jn...@jnthn.net via RT
On Tue, 03 Jan 2017 12:36:10 -0800, c...@zoffix.com wrote:
> On Tue, 03 Jan 2017 10:33:31 -0800, ronaldxs wrote:
> > Links:
> > --
> > [1] https://github.com/perl6/doc/issues/1104
> > [2]
> > https://github.com/perl6/Pod-To-
> > HTML/blob/master/lib/Pod/To/HTML.pm#L300
> 
> 
> Confirmed on Rakudo version 2016.12-52-g9eed276 built on MoarVM
> version 2016.12-6-g65acd55 on running on Linux. Memory keeps slowly
> increasing; got up to 1.1GB by 48000 iterations.

Worth retrying on HEAD, which has a number of fixes and improvements resulting 
from analyzing this issue.

/jnthn


[perl #130532] [JVM] Failing tests for itemization of arguments with infix: after introduction of Rakudo::Internals.OneValueIterator

2017-01-10 Thread Christian Bartolomaeus via RT
On Sun, 08 Jan 2017 23:31:11 -0800, barto...@gmx.de wrote:
> Since the new Rakudo::Internals.OneValueIterator is used in infix:
> (Rakudo commit c405f06724) there are four failing tests in
> S03-metaops/zip.t on rakudo-j.
> 
> One example of failing code:
> 
> $ ./perl6-j -e 'say $(1, 2) Z '
> (((1 2) a) ((Mu) b) ((Mu) c))
> 
> $ ./perl6-m -e 'say $(1, 2) Z '
> (((1 2) a))
> 
> I investigated a bit and it looks like $!value is Mu here on rakudo-j
> (instead of nqp::null on rakudo-m):
> 
> https://github.com/rakudo/rakudo/blob/fbbe446c64fbf98f3fc7e64016e5213a3ee1f09f/src/core/Rakudo/Internals.pm#L1002

I managed to golf this a bit:

$ ./perl6-j -e 'use nqp; class A { has Mu $!foo; method bar () { $!foo := 
nqp::null; say nqp::isnull($!foo) ?? "null" !! $!foo } }.new.bar'
(Mu)


Re: [perl #130533] how to export alias to module function?

2017-01-10 Thread Alexey Melezhik
Hi Lloyd!

> Seems to be it bugs out if you put "is export" on a
constant decl where the RHS is a &sub.

Exactly.

Meanwhile I just do something like this:

sub foo-alias is export { foo }

This works for me two. I will be waiting till bug is fixed so to rely
on better Perl6 syntax. SO, no hurry. Thanks

2017-01-10 14:35 GMT+03:00 Lloyd Fournier via RT :
> Looks like a bug to me. Seems to be it bugs out if you put "is export" on a
> constant decl where the RHS is a &sub.
>
> You could do this until it's fixed:
>
> sub foo is export { }
> BEGIN EXPORT::DEFAULT::{'&foo-alias'} = &foo;
>
> On Tue, Jan 10, 2017 at 1:21 AM Alexey Melezhik <
> perl6-bugs-follo...@perl.org> wrote:
>
> # New Ticket Created by  Alexey Melezhik
> # Please include the string:  [perl #130533]
> # in the subject line of all future correspondence about this issue.
> # https://rt.perl.org/Ticket/Display.html?id=130533 >
>
>
> HI!
>
> Probably I  I miss the syntax, but I am trying to make an alias for
> exported module function and have this alias exported either.
>
> $ cat lib/Foo.pm6
> use v6;
>
> unit module Foo;
>
> sub foo is export { say "hi there" }
>
>
> $ perl6 -Ilib  -e 'use Foo; foo()'
> hi there
>
>
> ///
>
> $ cat lib/Foo.pm6
> use v6;
>
> unit module Foo;
>
> sub foo is export { say "hi there" }
>
> constant &foo-alias = &foo;
>
> perl6 -Ilib  -e 'use Foo; Foo::foo-alias()'
> hi there
>
> ///
>
> But last one does not compile:
>
> use v6;
>
> unit module Foo;
>
> sub foo is export { say "hi there" }
>
> constant &foo-alias is export = &foo;
>
>
> $ perl6  -c lib/Foo.pm6
> ===SORRY!=== Error while compiling /home/melezhik/projects/tmp/lib/Foo.pm6
> Can't use unknown trait 'is export' in a sub declaration.
> at /home/melezhik/projects/tmp/lib/Foo.pm6:7
> expecting any of:
> rw raw hidden-from-backtrace hidden-from-USAGE
> pure default DEPRECATED inlinable nodal
> prec equiv tighter looser assoc leading_docs trailing_docs
>
>
> Regards.
>
> Alexey
>


Re: Re-export symbols

2017-01-10 Thread Lloyd Fournier
Hey Fernando,

This is not yet implemented in rakudo. I included a way of doing this in
CompUnit::Util . I'm
not sure when/if :EXPORT will be implemented (I actually don't think it's a
good idea).

I've just realised that there is another solution though. You can do this:

use FirstModule;
my package EXPORT::DEFAULT { } # initialise the export namespace
BEGIN for <&foo &bar &baz> { # iterate over the things you want to
re-export by default
EXPORT::DEFAULT::{$_} = ::($_)
}

This actually might be worth adding to the docs.

LL



On Sat, Dec 31, 2016 at 8:43 AM Fernando Santagata <
nando.santag...@gmail.com> wrote:

> Hello,
>
> I have a module that defines some constants and another one that use the
> first module.
> I wish to re-export those constants.
>
> I read here:
>
> http://design.perl6.org/S11.html
>
> that this:
>
> use FirstModule :EXPORT;
>
> should re-export the imported symbols, but it throws an error (no such tag
> 'EXPORT').
>
> Any idea?
>
> --
> Fernando Santagata
>


[perl #130535] Dynamic module loading by require in another modules has broken recently?

2017-01-10 Thread via RT
# New Ticket Created by  Asato Wakisaka 
# Please include the string:  [perl #130535]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=130535 >


With recent moarvm, loading modules dynamically by require ::("Some::Module") 
in another module fails and throws error.
Here are sample codes to reproduce: https://github.com/skaji/Crust-issue

The sample codes above works fine in rakudo-2016.11, but throws exception like 
"No such symbol 'C::B'" in recent one.

$ perl6 -version
This is Rakudo version 2016.12-239-gc405f0672 built on MoarVM version 
2016.12-71-g331a6b43
implementing Perl 6.c.

And, it runs properly when the "require" is placed under main, not in the 
module. (ref: https://github.com/skaji/Crust-issue/pull/1 )

It seems recent changes about lexical "use" affected?

Regards.

Asato Wakisaka (github.com/astj)


[perl #130518] [TAP6] Harness fails with description for whole-file skippage

2017-01-10 Thread Zoffix Znet via RT
On Thu, 05 Jan 2017 14:33:21 -0800, c...@zoffix.com wrote:
> TAP v12 spec[^1] shows the following as an example as TAP output that
> can be used to skip all tests with description:
> 
> 1..0 # Skipped: WWW::Mechanize not installed
> 
> However, trying to run TAP::Harness with such output crashes it with
> some failed internal typecheck:

Thank you for the report. This is now fixed.

Fix: https://github.com/rakudo/rakudo/commit/aee7af356c
Test: https://github.com/rakudo/rakudo/commit/aee7af356c


Re: Hi perl6 users

2017-01-10 Thread faraco3

Web and CLI oriented? Maybe GUI? If I understand you question.


On Ahad 08 Jan 2017 03:21 , Parrot Raiser wrote:

Welcome. What are your principal applications for P6 likely to be?

On 1/7/17, faraco  wrote:

Hello, I'm new here.

Firstly, I like Perl 6. It has some nice attractive features that makes
me want to finally settle down to learn the language, the beauty and the
ugly, and become a part of this growing community.

Despite of what people say about Perl and Perl 6 users community, I
found the community is helpful and friendly, full of clever and skillful
mind.

So here I am, to learn from the others, and to contribute anything I
can.

Thanks.

--
sincerely, faraco




Re: [perl #130520] [RFC] Deprecate `flatmap`

2017-01-10 Thread Lloyd Fournier
I took a look through my codebase to see where I have used flatmap. Every
place I think I would prefer map({ }).flat on second look.

so +1

LL


On Fri, Jan 6, 2017 at 4:47 PM Sam S.  wrote:

> # New Ticket Created by  Sam S.
> # Please include the string:  [perl #130520]
> # in the subject line of all future correspondence about this issue.
> # https://rt.perl.org/Ticket/Display.html?id=130520 >
>
>
> So, Perl 6 has a built-in `flatmap` routine:
>
> .flatmap({ ... })
>
> Show of hands: Who is reasonably sure, without testing it or looking
> it up, which of the following four expressions it corresponds to?
>
> .flat.map({ ... })
>
> .map({ ... }).flat
>
> .flat.map({ ... }).flat
>
> .map({ slip ... })
>
> And if Perl 6 regulars and core developers can't tell, do you think a
> typical Perl 6 newbie will guess correctly, and that code reviewers
> will notice when the wrong behavior was assumed?
>
> Note that the four behaviors are the same (or at least easy to
> confuse) for many simple cases - so it's quite possible to assume the
> wrong one even after a quick test, if one didn't test the more
> complicated inputs for which where they do differ.
>
> ---
>
> Second strike: Whoever wrote the p6doc entry
>  assumed the wrong behavior as
> well, and no one else seems to have noticed or cared. (See my initial
> report at .)
>
> Third strike: Its behavior isn't actually tested in Roast. The single
> Roast test that exists for it
> 
> merely tests that it is nodal, and doesn't distinguish between the
> four possible behaviors listed above.
>
> Fourth strike: Whereas `deepmap` and `duckmap` differ from plain `map`
> in how they iterate the input and how often they call the lambda,
> `flatmap` is the same as `map` in those regards and differs, rather,
> in how it collects the output. Users who take the naming scheme
> "deepmap, duckmap, flatmap" as an indication that these are three of a
> kind, will assume the wrong behavior for `flatmap`.
>
> ---
>
> Is all that confusion (and the needless proliferation of the Perl 6
> core setting) worth it, just to save typing a single character in a
> specific circumstance?
>
> Unless I'm missing something vital, I'd say it's hard to argue that
> the answer is "yes".
>
> I therefore suggest initiating the deprecation cycle in order to
> eventually drop of this routine from the Perl 6 language and Rakudo
> implementation.
>


Re: [perl #130533] how to export alias to module function?

2017-01-10 Thread Lloyd Fournier
Looks like a bug to me. Seems to be it bugs out if you put "is export" on a
constant decl where the RHS is a &sub.

You could do this until it's fixed:

sub foo is export { }
BEGIN EXPORT::DEFAULT::{'&foo-alias'} = &foo;

On Tue, Jan 10, 2017 at 1:21 AM Alexey Melezhik <
perl6-bugs-follo...@perl.org> wrote:

# New Ticket Created by  Alexey Melezhik
# Please include the string:  [perl #130533]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=130533 >


HI!

Probably I  I miss the syntax, but I am trying to make an alias for
exported module function and have this alias exported either.

$ cat lib/Foo.pm6
use v6;

unit module Foo;

sub foo is export { say "hi there" }


$ perl6 -Ilib  -e 'use Foo; foo()'
hi there


///

$ cat lib/Foo.pm6
use v6;

unit module Foo;

sub foo is export { say "hi there" }

constant &foo-alias = &foo;

perl6 -Ilib  -e 'use Foo; Foo::foo-alias()'
hi there

///

But last one does not compile:

use v6;

unit module Foo;

sub foo is export { say "hi there" }

constant &foo-alias is export = &foo;


$ perl6  -c lib/Foo.pm6
===SORRY!=== Error while compiling /home/melezhik/projects/tmp/lib/Foo.pm6
Can't use unknown trait 'is export' in a sub declaration.
at /home/melezhik/projects/tmp/lib/Foo.pm6:7
expecting any of:
rw raw hidden-from-backtrace hidden-from-USAGE
pure default DEPRECATED inlinable nodal
prec equiv tighter looser assoc leading_docs trailing_docs


Regards.

Alexey


Re: Re-export symbols

2017-01-10 Thread Fernando Santagata
Thank you that's very interesting.

I solved the problem I had, refactoring the modules I was working on: after
all I didn't have to ask anyone. Still the problem would bug me.

Thanks again!

On Tue, Jan 10, 2017 at 12:25 PM, Lloyd Fournier 
wrote:

> Hey Fernando,
>
> This is not yet implemented in rakudo. I included a way of doing this in
> CompUnit::Util .
> I'm not sure when/if :EXPORT will be implemented (I actually don't think
> it's a good idea).
>
> I've just realised that there is another solution though. You can do this:
>
> use FirstModule;
> my package EXPORT::DEFAULT { } # initialise the export namespace
> BEGIN for <&foo &bar &baz> { # iterate over the things you want to
> re-export by default
> EXPORT::DEFAULT::{$_} = ::($_)
> }
>
> This actually might be worth adding to the docs.
>
> LL
>
>
>
> On Sat, Dec 31, 2016 at 8:43 AM Fernando Santagata <
> nando.santag...@gmail.com> wrote:
>
>> Hello,
>>
>> I have a module that defines some constants and another one that use the
>> first module.
>> I wish to re-export those constants.
>>
>> I read here:
>>
>> http://design.perl6.org/S11.html
>>
>> that this:
>>
>> use FirstModule :EXPORT;
>>
>> should re-export the imported symbols, but it throws an error (no such
>> tag 'EXPORT').
>>
>> Any idea?
>>
>> --
>> Fernando Santagata
>>
>


-- 
Fernando Santagata