Re: [perl #130492] subtest fails on windows

2017-01-03 Thread Marcel Timmerman
Sorry for the false alarm. I need to find out how to get the latest version 
on appveyor. It was fixed on a very early date, 2016.4 if I recall it 
correctly,


Anyways, thanks
Marcel


On January 3, 2017 2:50:31 PM "Zoffix Znet via RT" 
 wrote:



On Tue, 03 Jan 2017 00:28:25 -0800, mt1...@gmail.com wrote:

running tests on the Appveyor system I noticed the following;


prove -v --merge --exec "perl6 -Ilib" t
t\100-th.t ..
Type check failed in binding &subtests; expected Callable but got Str
("instantiate")
in sub subtest at
C:\rakudo\share\perl6\sources\C712FE6969F786C9380D643DF17E85D06868219E
(Test) line 292
in block  at t\100-th.t line 6
Dubious, test returned 1 (wstat 256, 0x100)


It was the first time I switched the arguments to subtest because I've
seen others doing it and I like it better.

Earlier I did "subtest { ... tests ... }, 'description';"
Here I did "subtest 'description', {... tests ... };"

On linux there are no problems;

Regards
Marcel


That's because on Windows you're using Rakudo that's too old. Upgrade to 
version 2016.07 or newer.


In the future, please include versions of the compiler you're using. You 
can get those by running perl6 -v







Re: [perl #130460] Can we relax indir's test on the target directory?

2017-01-03 Thread Joachim Durchholz

Am 03.01.2017 um 09:59 schrieb Elizabeth Mattijsen:

On 3 Jan 2017, at 06:58, Joachim Durchholz  wrote:
Yes, chdir is nasty because it's a global setting and you never know which of 
the functions you're calling might be changing the setting.

indir solves all these things. (Provided it changes the current directory back 
even in the face of exceptions.)


Please note that there is no real chdir() at the OS level, because that is a 
bad idea in a threaded environment.  And for that reason, the JVM doesn’t allow 
for it, afaik, and thus it wouldn’t work on the JVM backend anyway.


That would be the JDK, not the JVM (which does not implement these things).
But right, there is no good way to change the current working directory 
in Java, which is the Right Thing to Do(TM) in my book actually.



The “current directory” is represented by the $*CWD dynamic variable.  Changing 
the “current directory” in a scope, is nothing else than syntactic sugar around 
creating a local lexical $*CWD.  By virtue of the destruction of lexical 
variables when they go out of scope, this will also work if the scope is exited 
by an exception.


Ah, I didn't know what.
That's much better than what Python has :-)


4) The topic of this ticket: its default set of tests for the directory will 
change (just test if it's a directory?)

Some platform might even be okay with a nondirectory for chdir. This wouldn't 
be particularly useful, but we can't assume that all platforms do only useful 
things.

That said, I think the indir tests should just test that chdir is being called 
at the right times with the right arguments (can Perl6 tests do mocking? that 
would be needed)
So any error case testing can be done for chdir.


Since changing the current directory is nothing else than changing $*CWD, 
mocking should not be a problem.


+1


Not every change will be possible, because we can't break existing spectests,

Oh, is Perl6 that stable now?
I thought it should still be possible to fix mistakes.


I hear they’re still fixing mistakes in Perl 5.  Which, in my impression, is 
considered stable by many  :-)


:-D


[perl #128123] [JVM] in some cases wrong multi candidates are selected

2017-01-03 Thread Christian Bartolomaeus via RT
On Tue, 13 Sep 2016 12:42:03 -0700, barto...@gmx.de wrote:
> All code examples from above are running fine now.
> 
> Instead there are four skipped tests in S32-array/adverbs.t which die
> because the wrong multi postcircumfix:<[ ]> is selected.
> 
> I'll change the subject of this ticket and leave it open to collect
> those weird errors about wrong multi candidates used.

And now the tests in S32-array/adverbs.t are also passing. I'm closing this 
ticket as 'resolved' -- even if I neither know what caused the breakage nor 
what fixed it.


[perl #128264] [JVM] Failing test for calling .Num on Rat with denominator of zero

2017-01-03 Thread Christian Bartolomaeus via RT
Those tests are passing (again). I'm closing this ticket as 'resolved'.


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

2017-01-03 Thread Zoffix Znet via RT
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.




[perl #130208] Multi-line comments before role causes punning

2017-01-03 Thread jn...@jnthn.net via RT
On Mon, 28 Nov 2016 15:20:12 -0800, m...@orbislumen.net wrote:
> Multi-line comments in the form of #|{ } cause punning when before role 
> definition.
> 
> However, #`{ } does not.
> 
> https://gist.github.com/adaptiveoptics/6c58095c5dd99d725487989c282f9214
> 

The former is a Pod documentation attachment, while the latter is purely a 
comment, which is why it wasn't afflicted. Fixed the bug, and added a test to 
cover it in S26-documentation/block-leading.t.

/jnthn


[perl #125135] Using callsame from add_method in Metamodel subclass as the last statement in add_method only works half of the time

2017-01-03 Thread jn...@jnthn.net via RT
On Tue, 03 Jan 2017 10:11:23 -0800, jn...@jnthn.net wrote:
> On Thu, 07 May 2015 20:30:53 -0700, r...@hoelz.ro wrote:
> > When invoking callsame in add_method when making a custom metaclass,
> > callsame fails to invoke the next candidate on even-numbered
> > invocations.  Adding an explicit return in front of callsame, or a
> > statement after it (ex. say 'hi') fixes the issue.  Please consult
> > the
> > attached code.
> >
> > I dug into the callsame code a bit, and it seems that the same
> > dispatcher object is used between calls.  This causes the dispatcher
> > to incorrectly think that it is out of candidates on odd-numbered
> > invocations of callsame.  I don't know how the dispatcher object is
> > initialized; I would be happy to dig into this further if someone
> > could point me in the right direction.
> 
> This works now on HEAD, and just needs a test (which I believe is
> already being worked on).

Tested in S12-meta/classhow.t by dogbert17++; resolving.



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

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


The example below is believed to be a simplification of memory leak
Issue #1104 [1] for the htmlify.p6 program of
http://github.com/perl6/doc. 

The program just echoes numbered lines through the UNIX 'cat' program
and uses Perl 6 multiprocessing mechanisms to read back the echoed
lines.  It leaks 1 Gig of memory on my system fairly quickly. 

This issue occurs with Perl 6 doc generation of pod code blocks.  At
Pod::To::HTML line 300 [2] a callback mechanism is used which htmlify.p6
uses to format some pod code blocks using Node.js.  The code below does
a simplified simulation of those callbacks. 

my $proc = Proc::Async.new('/usr/bin/env', 'cat', :r, :w);
my $proc-supply = $proc.stdout.lines;
my $proc-prom = $proc.start;

my $last;
loop (my $i = 0; $i < 10_000; $i++) {

say $i if $i %% 1_000;

my $p = Promise.new;

my $tap = $proc-supply.tap( -> $cat-echo {
$p.keep($cat-echo);
$tap.close();
} );

$proc.say('line ' ~ $i); # $tmp_fname);
await $p;
$last = $p.result;
}

say $last;

  

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


[perl #125135] Using callsame from add_method in Metamodel subclass as the last statement in add_method only works half of the time

2017-01-03 Thread jn...@jnthn.net via RT
On Thu, 07 May 2015 20:30:53 -0700, r...@hoelz.ro wrote:
> When invoking callsame in add_method when making a custom metaclass,
> callsame fails to invoke the next candidate on even-numbered
> invocations.  Adding an explicit return in front of callsame, or a
> statement after it (ex. say 'hi') fixes the issue.  Please consult the
> attached code.
> 
> I dug into the callsame code a bit, and it seems that the same
> dispatcher object is used between calls.  This causes the dispatcher
> to incorrectly think that it is out of candidates on odd-numbered
> invocations of callsame.  I don't know how the dispatcher object is
> initialized; I would be happy to dig into this further if someone
> could point me in the right direction.

This works now on HEAD, and just needs a test (which I believe is already being 
worked on).




[perl #123989] [BUG] endless loop when calling nextsame in two multis differing only by constraints

2017-01-03 Thread jn...@jnthn.net via RT
On Thu, 05 Mar 2015 02:12:21 -0800, n...@detonation.org wrote:
> multi foo(Int $foo where * > 0) {
> say ">0";
> nextsame;
> }
> multi foo(Int $foo where * < 10) {
> say "<10";
> nextsame;
> }
> multi foo($foo) {
> say "generic";
> }
> foo(1);
> 
> 
> prints:
> >0
> <10
> <10
> <10
> <10
> ...
> and loops endlessly

Fixed and test added to S12-methods/defer-next.t.

/jnthn



[perl #130493] .sink of class not getting called, but Mu.sink is

2017-01-03 Thread jn...@jnthn.net via RT
On Tue, 03 Jan 2017 04:54:52 -0800, elizabeth wrote:
> $ 6 'class A { method sink() { say "goodbye" } }; A’
> WARNINGS for -e:
> Useless use of constant value A in sink context (line 1)
> 
> I would expected this to say “goodbye” rather than being silent and
> issuing a warning.  The fact that a class has a specific .sink method
> indicates that the developer had a plan for functioning in a sink
> environment.  So it should a. call that method and b. not issue a
> warning.
> 
I think we consciously decided that use of a type object in sink context would 
always warn (justification is that it's been known to catch the odd precedence 
thinko). Note that with an instance:

$ perl6-m 'class A { method sink() { say "goodbye" } }; A.new'
goodbye

It does exactly what you expect.

/jnthn


Re: [perl #130460] Can we relax indir's test on the target directory?

2017-01-03 Thread Brandon Allbery
On Tue, Jan 3, 2017 at 12:58 AM, Joachim Durchholz  wrote:
>
> indir solves all these things. (Provided it changes the current directory
> back even in the face of exceptions.)


Edge case: current directory can't be re-entered by path (as with the old
MMDF trick: daemon launcher running as root chdir()s to a directory via a
path where one component is only searchable by root, then drops perms and
runs the real daemon. Another way to do it is rename() or rmdir() one path
component). This can be worked around if the platform supports fchdir(),
otherwise you just can't get back where you were.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


[perl #130492] subtest fails on windows

2017-01-03 Thread Zoffix Znet via RT
On Tue, 03 Jan 2017 00:28:25 -0800, mt1...@gmail.com wrote:
> running tests on the Appveyor system I noticed the following;
> 
> 
> prove -v --merge --exec "perl6 -Ilib" t
> t\100-th.t ..
> Type check failed in binding &subtests; expected Callable but got Str 
> ("instantiate")
> in sub subtest at 
> C:\rakudo\share\perl6\sources\C712FE6969F786C9380D643DF17E85D06868219E 
> (Test) line 292
> in block  at t\100-th.t line 6
> Dubious, test returned 1 (wstat 256, 0x100)
> 
> 
> It was the first time I switched the arguments to subtest because I've 
> seen others doing it and I like it better.
> 
> Earlier I did "subtest { ... tests ... }, 'description';"
> Here I did "subtest 'description', {... tests ... };"
> 
> On linux there are no problems;
> 
> Regards
> Marcel

That's because on Windows you're using Rakudo that's too old. Upgrade to 
version 2016.07 or newer.

In the future, please include versions of the compiler you're using. You can 
get those by running perl6 -v



[perl #130493] .sink of class not getting called, but Mu.sink is

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


$ 6 'class A { method sink() { say "goodbye" } }; A’
WARNINGS for -e:
Useless use of constant value A in sink context (line 1)

I would expected this to say “goodbye” rather than being silent and issuing a 
warning.  The fact that a class has a specific .sink method indicates that the 
developer had a plan for functioning in a sink environment.  So it should a. 
call that method and b. not issue a warning.

Adding an nqp::say(“sunk”) to Mu.sink reveals that in the above case Mu.sink 
*does* appear to be called.


Re: Array containing only elements that implement a role.

2017-01-03 Thread Siavash

Hi,

It's because of the default value of array elements. See the end of this
section: https://docs.perl6.org/language/list#Typing

my @a;
say @a.of.perl; # Mu
say @a.default.perl; # Any
say @a[0]; # (Any)

role Foo {};
my Foo @a;
say @a.of.perl; # Foo
say @a.default.perl; # Foo
say @a[0] # (Foo)

On 2017-01-03 10:59:34 GMT, Martin Barth wrote:
> Hi There,
>
> I am not sure if my RoleType @array; is correct, or if there is a better 
> way to declare such an array. But I find the error that is happening 
> when there are no elements in the array confusing on the first sight. It 
> took me a while to realize that my array was empty and therefore it 
> "means" the class/role itself.
>
>
>  > perl6 -e 'role Foo {method n{...}}; class Bar does Foo {method 
> n{"n"}}; my Foo@a = (); @a.push: Bar.new; say @a[0].n'
> n
>
>  > perl6 -e 'role Foo {method n{...}}; class Bar does Foo {method 
> n{"n"}}; my Foo@a = (); say @a[0].n'
> Method 'n' must be implemented by Foo because it is required by a role
>in any compose_method_table at gen/moar/m-Metamodel.nqp line 2824
>in any apply at gen/moar/m-Metamodel.nqp line 2834
>in any compose at gen/moar/m-Metamodel.nqp line 3006
>in any make_pun at gen/moar/m-Metamodel.nqp line 1692
>in any find_method at gen/moar/m-Metamodel.nqp line 1720
>in block  at -e line 1
>
>  > perl6 -e 'role Foo {method n{...}}; class Bar does Foo {method 
> n{"n"}}; my @a = (); say @a[0].n'
> No such method 'n' for invocant of type 'Any'
>in block  at -e line 1



Array containing only elements that implement a role.

2017-01-03 Thread Martin Barth

Hi There,

I am not sure if my RoleType @array; is correct, or if there is a better 
way to declare such an array. But I find the error that is happening 
when there are no elements in the array confusing on the first sight. It 
took me a while to realize that my array was empty and therefore it 
"means" the class/role itself.



> perl6 -e 'role Foo {method n{...}}; class Bar does Foo {method 
n{"n"}}; my Foo@a = (); @a.push: Bar.new; say @a[0].n'

n

> perl6 -e 'role Foo {method n{...}}; class Bar does Foo {method 
n{"n"}}; my Foo@a = (); say @a[0].n'

Method 'n' must be implemented by Foo because it is required by a role
  in any compose_method_table at gen/moar/m-Metamodel.nqp line 2824
  in any apply at gen/moar/m-Metamodel.nqp line 2834
  in any compose at gen/moar/m-Metamodel.nqp line 3006
  in any make_pun at gen/moar/m-Metamodel.nqp line 1692
  in any find_method at gen/moar/m-Metamodel.nqp line 1720
  in block  at -e line 1

> perl6 -e 'role Foo {method n{...}}; class Bar does Foo {method 
n{"n"}}; my @a = (); say @a[0].n'

No such method 'n' for invocant of type 'Any'
  in block  at -e line 1



Re: [perl #130460] Can we relax indir's test on the target directory?

2017-01-03 Thread Elizabeth Mattijsen
> On 3 Jan 2017, at 06:58, Joachim Durchholz  wrote:
> Yes, chdir is nasty because it's a global setting and you never know which of 
> the functions you're calling might be changing the setting.
> 
> indir solves all these things. (Provided it changes the current directory 
> back even in the face of exceptions.)

Please note that there is no real chdir() at the OS level, because that is a 
bad idea in a threaded environment.  And for that reason, the JVM doesn’t allow 
for it, afaik, and thus it wouldn’t work on the JVM backend anyway.

The “current directory” is represented by the $*CWD dynamic variable.  Changing 
the “current directory” in a scope, is nothing else than syntactic sugar around 
creating a local lexical $*CWD.  By virtue of the destruction of lexical 
variables when they go out of scope, this will also work if the scope is exited 
by an exception.


>> 4) The topic of this ticket: its default set of tests for the directory will 
>> change (just test if it's a directory?)
> Some platform might even be okay with a nondirectory for chdir. This wouldn't 
> be particularly useful, but we can't assume that all platforms do only useful 
> things.
> 
> That said, I think the indir tests should just test that chdir is being 
> called at the right times with the right arguments (can Perl6 tests do 
> mocking? that would be needed)
> So any error case testing can be done for chdir.

Since changing the current directory is nothing else than changing $*CWD, 
mocking should not be a problem.


>> Not every change will be possible, because we can't break existing spectests,
> Oh, is Perl6 that stable now?
> I thought it should still be possible to fix mistakes.

I hear they’re still fixing mistakes in Perl 5.  Which, in my impression, is 
considered stable by many  :-)


Liz

[perl #130492] subtest fails on windows

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


running tests on the Appveyor system I noticed the following;


prove -v --merge --exec "perl6 -Ilib" t
t\100-th.t ..
Type check failed in binding &subtests; expected Callable but got Str 
("instantiate")
in sub subtest at 
C:\rakudo\share\perl6\sources\C712FE6969F786C9380D643DF17E85D06868219E 
(Test) line 292
in block  at t\100-th.t line 6
Dubious, test returned 1 (wstat 256, 0x100)


It was the first time I switched the arguments to subtest because I've 
seen others doing it and I like it better.

Earlier I did "subtest { ... tests ... }, 'description';"
Here I did "subtest 'description', {... tests ... };"

On linux there are no problems;

Regards
Marcel