[perl #104980] natively typed attributes and BUILD methods don't mix

2017-09-21 Thread Christian Bartolomaeus via RT
On Thu, 21 Sep 2017 19:50:01 -0700, b...@abrij.org wrote:
> 
> Current behavior (don't have a rakudo-j here):
> 
> $ perl6-m -e 'class A { has str $.x; method BUILD(:$!x) { } }; say
> A.new(:x).x'
> foo
> 
> If r-j now works too, we can move to TESTNEEDED.

Yeah, looks good on rakudo-j, too:

$ ./perl6-j -e 'class A { has str $.x; method BUILD(:$!x) { } }; say 
A.new(:x).x'
foo

I'm marking the isse as TESTNEEDED.


[perl #104980] natively typed attributes and BUILD methods don't mix

2017-09-21 Thread Brian S. Julin via RT
On Sun, 01 Mar 2015 12:29:14 -0800, barto...@gmx.de wrote:
> As a status update: This currently fails with:
> 
> $ perl6-m -e 'class A { has str $.x; method BUILD(:$!x) { } }; say
> A.new(:x).x'
> Cannot modify an immutable str
>   in method BUILD at -e:1
>   in method BUILDALL at src/gen/m-CORE.setting:983
>   in method bless at src/gen/m-CORE.setting:966
>   in method new at src/gen/m-CORE.setting:952
>   in block  at -e:1
> 
> $ perl6-j -e 'class A { has str $.x; method BUILD(:$!x) { } }; say
> A.new(:x).x'
> java.lang.RuntimeException: Cannot access a native attribute as a
> reference attribute
>   in method BUILD at -e:1
>   in method BUILDALL at gen/jvm/CORE.setting:965
>   in method bless at gen/jvm/CORE.setting:948
>   in method new at gen/jvm/CORE.setting:934
>   in block  at -e:1
> 
> $ perl6-m --version
> This is perl6 version 2015.02-151-g669f482 built on MoarVM version
> 2015.02-17-g86d0c68


Current behavior (don't have a rakudo-j here):

$ perl6-m -e 'class A { has str $.x; method BUILD(:$!x) { } }; say 
A.new(:x).x'
foo

If r-j now works too, we can move to TESTNEEDED.


[perl #129812] [OPTIMIZER] `is rw` candidates get called even if a non-rw argument is passed

2017-09-21 Thread Brian S. Julin via RT
On Sat, 05 Aug 2017 06:28:34 -0700, jan-olof.hen...@bredband.net wrote:
> On Wed, 05 Oct 2016 14:23:57 -0700, c...@zoffix.com wrote:
> >
> > This code shows the bug:
> >
> > zoffix@leliana:~$ perl6 -e 'm: multi foo ($) {"right" }; multi
> > foo ($ is rw) {"wrong"}; say foo "42"'
> > wrong
> >
> > And if we turn off the optimizer, we get the right candidate called
> > (same would happen if we add more complex sub bodies, so possibly the
> > sub gets inlined):
> >
> > zoffix@leliana:~$ perl6 --optimize=off -e 'm: multi foo ($)
> > {"right" }; multi foo ($ is rw) {"wrong"}; say foo "42"'
> > right
> >
> 
> It would seem that this bug was fixed with
> https://github.com/rakudo/rakudo/commit/f8b3469439108fead043bab2bd27bde4bac50dca
> Test(s) needed

Tests added with roast commit 63181b3c9.  So resolving.


Re: bash and pm6 question

2017-09-21 Thread Elizabeth Mattijsen
> On 22 Sep 2017, at 00:32, Bennett Todd  wrote:
> 
> With perl5, that could have been something like. "perl -Mmy -e ...", but I 
> don't have access to a perl6 at this instant to compare. There should be a 
> flag you can use to include a module into the.running environment before 
> evaluating the 
> "-e" code.
> 
> Using "use" within the "-e" string should work, too.

Guess what?  It’s also -M in Rakudo Perl 6:

$ perl6 -MTest -e 'ok 1’
ok 1 - 


Liz

Re: bash and pm6 question

2017-09-21 Thread Bennett Todd
With perl5, that could have been something like. "perl -Mmy -e ...", but I 
don't have access to a perl6 at this instant to compare. There should be a flag 
you can use to include a module into the.running environment before evaluating 
the 
"-e" code.

Using "use" within the "-e" string should work, too.


Re: bash and pm6 question

2017-09-21 Thread Todd Chester

On 09/21/2017 01:19 AM, Shlomi Fish wrote:

Hi Todd,

On Wed, 20 Sep 2017 23:22:41 -0700
ToddAndMargo  wrote:


Hi All,

Can I call a pm6 directly from bash or do I
need to call a pl6 that calls the pm6?



why not use "perl6 -e"?

Regards,

Shlomi
  


perl6 -e'use MyPm6; ...  ?


Re: Your posting is a bit unfortunate

2017-09-21 Thread Joachim Durchholz

I'll respond privately to keep the noise of the list.
Ask me to get cc'd.

Regards,
Jo


[perl #132140] Behaviour of bang-bang

2017-09-21 Thread via RT
# New Ticket Created by  Philippe 'BooK' Bruhat 
# Please include the string:  [perl #132140]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=132140 >


Experimenting with !! showed this:

$ perl6 -v
This is Rakudo version 2017.08-160-g7791dd47d built on MoarVM version 
2017.08.1-171-gcf95892e
implementing Perl 6.c.

$ perl6 -e 'say !""'
True

$ perl6 -e 'say ! ""'
True

$ perl6 -e 'say !!""'
False

$ perl6 -e 'say ! !""'
False

$ perl6 -e 'say ! ! ""'
False

$ perl6 -e 'say !!""'
False

$ perl6 -e 'say !! ""'
Non ast passed to WANTED: NQPMu
===SORRY!=== Error while compiling -e
Two terms in a row
at -e:1
--> say !!⏏ ""
expecting any of:
infix
infix stopper
postfix
statement end
statement modifier
statement modifier loop

$ perl6 -e 'say !!'
===SORRY!=== Error while compiling -e
Prefix ! requires an argument, but no valid term found
at -e:1
--> say !!⏏
expecting any of:
prefix

$ perl6 -e '!! while 1'
===SORRY!===
Cannot find method 'okifnil' on object of type NQPMu

$ perl6 -e '! while 1'
===SORRY!=== Error while compiling -e
Undeclared routine:
while used at line 1


Re: help with map and regexp

2017-09-21 Thread Brandon Allbery
On Thu, Sep 21, 2017 at 2:37 AM, Luca Ferrari  wrote:

> Out of cursiosity: what is the diffence between using "is copy" and "<->"?
> Seems to me the map example can work with both.
>

<-> is the same as "is rw" and requires that the thing being bound be a
mutable container, which will be altered if the binding is. "is copy"
instead creates a new mutable container holding a copy of the thing being
bound, so that changes to it are possible but won't affect the original.

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


Re: bash and pm6 question

2017-09-21 Thread Shlomi Fish
Hi Todd,

On Wed, 20 Sep 2017 23:22:41 -0700
ToddAndMargo  wrote:

> Hi All,
> 
> Can I call a pm6 directly from bash or do I
> need to call a pl6 that calls the pm6?
>

why not use "perl6 -e"?

Regards,

Shlomi
 
> 
> Many thanks,
> -T
> 



-- 
-
Shlomi Fish   http://www.shlomifish.org/
NSA Factoids - http://www.shlomifish.org/humour/bits/facts/NSA/

Selina: How may I be of service?
Alan: Well, according to the Codex, we’re supposed to be slain by you.
— http://www.shlomifish.org/humour/Selina-Mandrake/


Re: help with map and regexp

2017-09-21 Thread Brent Laabs
You can also use a whatever star with the subst method to avoid the block
entirely, and just chain method calls:

my @fields = $line.split( ',' ).map: *.subst(/\'/, "", :g).subst(/^\"|\"$/,
"", :g);


On Wed, Sep 20, 2017 at 11:37 PM, Luca Ferrari 
wrote:

> On Tue, Sep 19, 2017 at 2:43 PM, Timo Paulssen  wrote:
> > perl6 -e '.perl.say for "hello, how, are, you".split(",").map: -> $_
> > is copy { s:g/a//; s:g/^ \s|\s $/O/; $_ }'
> > "hello"
> > "Ohow"
> > "Ore"
> > "Oyou"
>
> Thanks.
> Out of cursiosity: what is the diffence between using "is copy" and "<->"?
> Seems to me the map example can work with both.
>
> Luca
>