Re: Need help with Nil values

2016-02-22 Thread TS xx
Thanks Brandon,


That was what I was looking for.

I'm trying it already.


Regards,

Emiliano



From: Brandon Allbery 
Sent: Tuesday, February 23, 2016 2:21 AM
To: TS xx
Cc: perl6-us...@perl.org
Subject: Re: Need help with Nil values


On Mon, Feb 22, 2016 at 9:15 PM, TS xx 
> wrote:
I expect $.value to hold Strings, but I want to be able to instantiate MyClass 
whether I have a value already or not, and I also want to be able to tell if 
$.value has a real String or not. Is this possible?

You don't want Nil there; it's not the undefined value, it's a value of a 
special type. You want Str, the type object for Strings, which also serves as 
the undefined value (also true for other types). You can test it with `defined`.

$myObject = MyClass.new(Str);

then you can test $!value.defined or whatever.

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


Re: Need help with Nil values

2016-02-22 Thread TS xx
Thanks,

That was it.
Somtimes I get confused with the way other languages treat undefined/null/nil 
values.

Regards,
Emiliano


From: Timo Paulssen 
Sent: Tuesday, February 23, 2016 2:20 AM
To: perl6-us...@perl.org
Subject: Re: Need help with Nil values

Hello Emiliano,

In this case, I think you may want to use just "Str" instead of "Nil".
"Str" is the "type object" for Str objects, and you can check whether
it's a string like "foo" or just the Str object by checking $!value.defined.

There's a FAQ answer that's about "Any", but it works the same way for
"Str":

 http://doc.perl6.org/language/faq#What_is_%28Any%29%3F

And there's the classtut that talks about this a bit more in depth,
search for "type object":

 http://doc.perl6.org/language/classtut


I hope this'll get you towards your goal. If not, just keep asking :)

Have fun with Perl 6!
   - Timo



Re: Need help with Nil values

2016-02-22 Thread Brandon Allbery
On Mon, Feb 22, 2016 at 9:15 PM, TS xx  wrote:

> I expect $.value to hold Strings, but I want to be able to instantiate
> MyClass whether I have a value already or not, and I also want to be able
> to tell if $.value has a real String or not. Is this possible?


You don't want Nil there; it's not the undefined value, it's a value of a
special type. You want Str, the type object for Strings, which also serves
as the undefined value (also true for other types). You can test it with
`defined`.

$myObject = MyClass.new(Str);

then you can test $!value.defined or whatever.

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


Re: Need help with Nil values

2016-02-22 Thread Timo Paulssen

Hello Emiliano,

In this case, I think you may want to use just "Str" instead of "Nil". 
"Str" is the "type object" for Str objects, and you can check whether 
it's a string like "foo" or just the Str object by checking $!value.defined.


There's a FAQ answer that's about "Any", but it works the same way for 
"Str":


http://doc.perl6.org/language/faq#What_is_%28Any%29%3F

And there's the classtut that talks about this a bit more in depth, 
search for "type object":


http://doc.perl6.org/language/classtut


I hope this'll get you towards your goal. If not, just keep asking :)

Have fun with Perl 6!
  - Timo



Need help with Nil values

2016-02-22 Thread TS xx
Dear perl 6 users,


I am trying to pass a Nil value to a method new of a class that expects a Str.

The method new will assign this Nil value to a Str member variable. Then, this 
value will change during runtime.


At the moment I am getting this error: Type check failed in binding $value; 
expected Str but got Nil


Here is an simplified example of what I'm doing:


class MyClass {
has Str $.value is rw;

method new (Str $value) {
return self.bless(:$value);
}

submethod BUILD (Str :$!value) {
}
}


$myObject = MyClass.new(Nil); # << this triggers the error



I expect $.value to hold Strings, but I want to be able to instantiate MyClass 
whether I have a value already or not, and I also want to be able to tell if 
$.value has a real String or not. Is this possible?


If anyone knows a way to do it or has any clue to solve this case, I would be 
glad to hear about it.


Thanks to all in advance,

Emiliano


Re: My personal benchmark shows no improvement with Rakudo 2016.02

2016-02-22 Thread Tom Browder
I gave my code to Liz.

-Tom

On Monday, February 22, 2016, Brent Laabs  wrote:

> Without a code sample or statistics, there's not much we can do about it.
>
> On Mon, Feb 22, 2016 at 4:56 PM, Tom Browder  > wrote:
>
>> Note that my read of a 10 Gb file shows no significant speed-up from
>> Rakudo 2016.01 to 2016.02.
>>
>> Best regards,
>>
>> -Tom
>>
>
>


Re: My personal benchmark shows no improvement with Rakudo 2016.02

2016-02-22 Thread Lloyd Fournier
Note, according to Tux++ csv benchmarks:

http://tux.nl/Talks/CSV6/speed4.html

It looks to have gotten slightly faster at parsing CSVs.

LL

On Tue, Feb 23, 2016 at 12:07 PM Brent Laabs  wrote:

> Without a code sample or statistics, there's not much we can do about it.
>
> On Mon, Feb 22, 2016 at 4:56 PM, Tom Browder 
> wrote:
>
>> Note that my read of a 10 Gb file shows no significant speed-up from
>> Rakudo 2016.01 to 2016.02.
>>
>> Best regards,
>>
>> -Tom
>>
>
>


Re: [perl #127587] [OS X] External process return values affecting react blocks

2016-02-22 Thread Lloyd Fournier
https://rt.perl.org/Public/Bug/Display.html?id=126277
https://rt.perl.org/Public/Bug/Display.html?id=125516
https://rt.perl.org/Public/Bug/Display.html?id=125758

Just a few other OS X problems for reference.

On Tue, Feb 23, 2016 at 3:41 AM ab5tract 
wrote:

> # New Ticket Created by  ab5tract
> # Please include the string:  [perl #127587]
> # in the subject line of all future correspondence about this issue.
> # https://rt.perl.org/Ticket/Display.html?id=127587 >
>
>
> I discovered this behavior while using IO.watch, but it is also
> demonstrable with a simple interval supply.
>
> It occurs with both Proc::Async and qq:x. I've included both for easy
> testing. The 'echo' never actually runs. I only get 'interval 1' and then
> the script returns.
>
> # Proc::Async
>
> sub MAIN {
> react {
> whenever Supply.interval(1) {
> start {
> my $phrase = "interval {++$}" .say;
> my $cmd = Proc::Async.new: 'echo', "echo: $phrase";
> $cmd.stdout.tap: *.say;
> await $cmd.start;
> }
> }
> }
> }
>
> ## qq:x
>
> sub MAIN {
> react {
> whenever Supply.interval(1) {
> start {
> my $phrase = "interval {++$}" .say;
> qq:x[ echo  "echo: $phrase" ];
> }
> }
> }
> }
>


Re: My personal benchmark shows no improvement with Rakudo 2016.02

2016-02-22 Thread Brent Laabs
Without a code sample or statistics, there's not much we can do about it.

On Mon, Feb 22, 2016 at 4:56 PM, Tom Browder  wrote:

> Note that my read of a 10 Gb file shows no significant speed-up from
> Rakudo 2016.01 to 2016.02.
>
> Best regards,
>
> -Tom
>


My personal benchmark shows no improvement with Rakudo 2016.02

2016-02-22 Thread Tom Browder
Note that my read of a 10 Gb file shows no significant speed-up from
Rakudo 2016.01 to 2016.02.

Best regards,

-Tom


Perl 6 for system-wide use: best practice?

2016-02-22 Thread Tom Browder
What is recommended for installing Perl 6 for system-wide use?

I'm comfortable running Perl 6 under my user directory and keeping it
current with the latest releases with rakudobrew, but what is the
recommended way to install for system-wide use?

Unless I hear otherwise, I plan to continue to use my own
user-installed .rakudobrew directory and give the appropriate paths to
other users and root (it's my private system and, so far, I have no
other users, although there may be some other users allowed later).

Thanks.

Best regards,

-Tom


Re: Most wanted module: Net::SMTP

2016-02-22 Thread Tom Browder
On Mon, Feb 22, 2016 at 9:32 AM, Will Coleda  wrote:
> On Mon, Feb 22, 2016 at 9:05 AM, Tom Browder  wrote:
>> On Mon, Feb 22, 2016 at 12:08 AM, Kaare Rasmussen  wrote:
>>> On 2016-02-20 20:50, Tom Browder wrote:
...
> Specifically not addressing the "should it be on the most wanted list
> or not still" question, but:
...
> No one is suggesting the ecosystem setup is in a final state; There
> will be hiccups like this as we grow.
...

Well said--thanks.

>> 2. How does one install a local (non-panda-list recognized) module
>> (e.g., one downloaded with git cl;one ...)?
...
> $ panda install .

Ah, now I see the dot: inside the source directory--most cool!

Thanks, Will!

Best regards,

-Tom


[perl #127587] [OS X] External process return values affecting react blocks

2016-02-22 Thread via RT
# New Ticket Created by  ab5tract 
# Please include the string:  [perl #127587]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=127587 >


I discovered this behavior while using IO.watch, but it is also
demonstrable with a simple interval supply.

It occurs with both Proc::Async and qq:x. I've included both for easy
testing. The 'echo' never actually runs. I only get 'interval 1' and then
the script returns.

# Proc::Async

sub MAIN {
react {
whenever Supply.interval(1) {
start {
my $phrase = "interval {++$}" .say;
my $cmd = Proc::Async.new: 'echo', "echo: $phrase";
$cmd.stdout.tap: *.say;
await $cmd.start;
}
}
}
}

## qq:x

sub MAIN {
react {
whenever Supply.interval(1) {
start {
my $phrase = "interval {++$}" .say;
qq:x[ echo  "echo: $phrase" ];
}
}
}
}


[perl #127580] [BUG] README/compiler_overview out of date

2016-02-22 Thread via RT
# New Ticket Created by  Bayle Shanks 
# Please include the string:  [perl #127580]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=127580 >


Browsing the README at Github,
https://github.com/rakudo/rakudo/blob/nom/README.md , i noticed it
says:

"
## How the compiler works

See `docs/compiler_overview.pod`.
"

I went to
https://github.com/rakudo/rakudo/blob/nom/docs/compiler_overview.pod
(which was last updated in 2013), and it explains how Rakudo compiles
to the Parrot virtual machine, which executes bytecode.

However, the Github project description for rakudo describes it as
"Perl 6 on MoarVM and the JVM" and 
http://rakudo.org/2015/02/21/announce-rakudo-star-release-2015-02/
says that the Parrot backend is no longer supported. Neither 'Moar'
nor 'JVM' appear in compiler_overview.pod

If Parrot is no longer the backend, then i suggest that
docs/compiler_overview.pod should be updated, or at least
deleted (no docs is better than (sufficiently) incorrect docs; if
compiler_overview.pod is deleted then the reference to it should also
be removed from the README).

thanks,
  b


Announce: Rakudo Perl 6 compiler, Release #96 (2016.02)

2016-02-22 Thread Will Coleda
On behalf of the Rakudo development team, I’m very happy to announce the
February 2016 release of Rakudo Perl 6 #96. Rakudo is an implementation of
Perl 6 on the Moar Virtual Machine[^1].

This release implements the 6.c version of the Perl 6 specifications.
It includes bugfixes and optimizations on top of
the 2015.12 release of Rakudo, but no new features.

Upcoming releases in 2016 will include new functionality that is not
part of the 6.c specification, available with a lexically scoped
pragma. Our goal is to insure that anything that is tested as part of the
6.c specification will continue to work unchanged. There may be incremental
spec releases this year as well.

The tarball for this release is available from
.

Please note: This announcement is not for the Rakudo Star
distribution[^2] --- it’s announcing a new release of the compiler
only. For the latest Rakudo Star release, see
.

The Rakudo Perl compiler follows a monthly release cycle, but please bear
with us post-Christmas. We are working hard to insure that we don’t break
anything now that we have a released spec, and it make take us a few months
to settle back into a rhythm.

The changes in this release are outlined below:

New in 2016.02:
 + Fixes:
   + Many memory leaks fixed in MoarVM
   + Set.hash now returns an object hash (RT #127402)
   + Use the order of arguments in usage display, rather than hash order
   + Specifying ::a now gives proper compile time error (RT #127504)
   + Enums with a type object now fail with an NYI error
   + .first(:end) on uncached iterators no longer fails
 + Additions:
   + REPL now supports multi-line statements (experimental)
   + Can now uninstall distributions
 + Efficiency:
   + Str.trans can now be up to 160x faster
   + @a.chrs noq 3x faster, chrs(@a) now 9x faster

These are only some of the changes in this release. For a more
detailed list, see “docs/ChangeLog”.

The following people contributed to this release:

Elizabeth Mattijsen, Pawel Murias, Jonathan Worthington, Will "Coke" Coleda,
Rob Hoelz, Moritz Lenz, Tobias Leich, Salvador Ortiz, Donald Hunter,
Timo Paulssen, niner, Stefan Seifert, Aleks-Daniel Jakimenko-Aleksejev,
Dave Rolsky, Jonathan Stowe, LLFourn, Nick Logan, okaoka, John Spurr,
Páll Haraldsson, Carl Masak, Zoffix Znet, Sylvain Colinet, Andy Weidenbaum,
Tommy Stanton

If you would like to contribute or find out more information, visit
, , ask on the
 mailing list, or ask on IRC #perl6 on freenode.

The next release of Rakudo (#97), is tentatively scheduled for 19 March 2016.

A list of the other planned release dates is available in the
“docs/release_guide.pod” file.

The development team appreciates feedback! If you’re using Rakudo, do
get back to us. Questions, comments, suggestions for improvements, cool
discoveries, incredible hacks, or any other feedback -- get in touch with
us through (the above-mentioned) mailing list or IRC channel. Enjoy!

Please note that recent releases have known issues running on the JVM.
We are working to get the JVM backend working again but do not yet have
an estimated delivery date.

[^1]: See 

[^2]: What’s the difference between the Rakudo compiler and the Rakudo
Star distribution?

The Rakudo compiler is a compiler for the Perl 6 language.
Not much more.

The Rakudo Star distribution is the Rakudo compiler plus a selection
of useful Perl 6 modules, a module installer, the most recent
incarnation of the “Using Perl 6” book, and other software that can
be used with the Rakudo compiler to enhance its utility. Rakudo Star
is meant for early adopters who wish to explore what’s possible with
Rakudo Perl 6 and provide feedback on what works, what doesn’t, and
what else they would like to see included in the distribution.


-- 
Will "Coke" Coleda


Re: Most wanted module: Net::SMTP

2016-02-22 Thread Will Coleda
On Mon, Feb 22, 2016 at 9:05 AM, Tom Browder  wrote:
> On Mon, Feb 22, 2016 at 12:08 AM, Kaare Rasmussen  wrote:
>> On 2016-02-20 20:50, Tom Browder wrote:
>>>
>>> I notice that module Net::SMTP is on the most wanted list and shown as
>>> a WIP. However, on a lark I decided to try:
>>
>> I guess you refer to
>> https://github.com/perl6/perl6-most-wanted/blob/master/most-wanted/modules.md
>> which seems to be a compilation of wishes for Perl 6.  Nobody can decide
>> what gets worked on in Perl 6; I think this is just a collection of ideas
>> for someone to pick up if they have time.
>>
>>> 1. Why is Net::SMTP available in the ecosystem if it is still a WIP
>>> (and doesn't pass testing)?
>
> Okay, I confused two issues.  Questions:
>
> 1. Shouldn't a Perl 6 module available in the Perl 6 ecosystem no
> longer be shown on the most wanted list?  (And if it's still a WIP,
> the installation via Panda should note that somehow.)

Specifically not addressing the "should it be on the most wanted list
or not still" question, but:

panda can't really tell if a module is "good", only if it's
installable. Seems like a README in the project repo is a good start
here. (and maybe something similar in the MW list). Or perhaps a
version convention.

I'm sure we can crib some notes from the perl 5 ecosystem here about
determining if a module has quality.

No one is suggesting the ecosystem setup is in a final state; There
will be hiccups like this as we grow.

> 2. How does one install a local (non-panda-list recognized) module
> (e.g., one downloaded with git cl;one ...)?
>
> Thanks.
>
> Best regards,
>
> -Tom

$ panda install .

-- 
Will "Coke" Coleda


Re: Most wanted module: Net::SMTP

2016-02-22 Thread Tom Browder
On Mon, Feb 22, 2016 at 12:08 AM, Kaare Rasmussen  wrote:
> On 2016-02-20 20:50, Tom Browder wrote:
>>
>> I notice that module Net::SMTP is on the most wanted list and shown as
>> a WIP. However, on a lark I decided to try:
>
> I guess you refer to
> https://github.com/perl6/perl6-most-wanted/blob/master/most-wanted/modules.md
> which seems to be a compilation of wishes for Perl 6.  Nobody can decide
> what gets worked on in Perl 6; I think this is just a collection of ideas
> for someone to pick up if they have time.
>
>> 1. Why is Net::SMTP available in the ecosystem if it is still a WIP
>> (and doesn't pass testing)?

Okay, I confused two issues.  Questions:

1. Shouldn't a Perl 6 module available in the Perl 6 ecosystem no
longer be shown on the most wanted list?  (And if it's still a WIP,
the installation via Panda should note that somehow.)

2. How does one install a local (non-panda-list recognized) module
(e.g., one downloaded with git cl;one ...)?

Thanks.

Best regards,

-Tom


Re: capture through regex variable

2016-02-22 Thread Tobias Leich

As a rule of thumb:

Every non-Letter character after the opening angle bracket makes it 
non-capturing.


Am 22.02.2016 um 11:37 schrieb Theo van den Heuvel:

Thanks Patrick,

it works great.

Theo

Patrick R. Michaud schreef op 2016-02-22 11:16:

Dynamic subregexes such as <$top> are non-capturing by default.  You
can easily capture the result by using something like 

Re: capture through regex variable

2016-02-22 Thread Theo van den Heuvel

Thanks Patrick,

it works great.

Theo

Patrick R. Michaud schreef op 2016-02-22 11:16:

Dynamic subregexes such as <$top> are non-capturing by default.  You
can easily capture the result by using something like 

Re: capture through regex variable

2016-02-22 Thread Patrick R. Michaud
Dynamic subregexes such as <$top> are non-capturing by default.  You can easily 
capture the result by using something like 

capture through regex variable

2016-02-22 Thread Theo van den Heuvel

Hi all,

I am trying to change a regex programmatically. For that I insert a 
variable in another regex. However, the match object appears to have 
lost the capture of the inner regex. In a code example:


=
my Match $match;

my $top = rx/ \( $ = [ \w* ] \) /;

given "(abc)" {
  $match = m/^ <$top>/;
}

if $match {
  say "core is { ~$ }";
}

=

Using the latest rakudo release (2016.01.1), I find that the matching 
process works but the capture gets lost. Any ideas?


Thanks,

--
Theo van den Heuvel
Van den Heuvel HLT Consultancy