Re: Need regex ^? help

2024-04-29 Thread Patrick R. Michaud
Perhaps not really what you're intending, but here's how I'd start:

$ raku -e 'my $x="1.2.3.4"; $x ~~ s!\d+$!0/24!; say $x;'
1.2.3.0/24

The pattern part of the substitution matches all of the digits at the end of 
the string (\d+$), then replaces them with the string "0/24".  Everything prior 
to those digits is left alone.

On Mon, Apr 29, 2024 at 05:45:49PM -0700, ToddAndMargo via perl6-users wrote:
> On 4/29/24 17:42, ToddAndMargo via perl6-users wrote:
> > Hi All,
> > 
> > I thought I understood ^ and ? used in a regex'es,
> > but I don't.
> > 
> > ^ means from the beginning and ? from the end.

I think you mean "$" here instead of "?".

Pm


Re: how do I turn a real into and array of Integers?

2021-11-01 Thread Patrick R. Michaud
This is a place where .comb() is likely much better than .split() -- .comb()
allows you to specify what you're wanting instead of what you're wanting to
avoid:

$ raku -e "say sqrt(2).comb(/\d/).join(', ');"
1, 4, 1, 4, 2, 1, 3, 5, 6, 2, 3, 7, 3, 0, 9, 5, 1

If you want only the first 10 digits, then:

$ raku -e "say sqrt(2).comb(/\d/)[^10].join(', ');"
1, 4, 1, 4, 2, 1, 3, 5, 6, 2

Pm


On Mon, Nov 01, 2021 at 06:55:40PM -0700, William Michels via perl6-users wrote:
> You did great for not knowing Raku!
> 
> ~$ raku -e "say sqrt(2).split(/\.|''/);"
> ( 1  4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1 )
> ~$ raku -e "say sqrt(2).split(/\.|''/).raku;"
> ("", "1", "", "4", "1", "4", "2", "1", "3", "5", "6", "2", "3", "7", "3",
> "0", "9", "5", "1", "").Seq
> ~$ raku -e "say sqrt(2).split(/\.|''/, :skip-empty);"
> (1 4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1)
> ~$ raku -e "say sqrt(2).split(/\.|''/, :skip-empty).join(', ');"
> 1, 4, 1, 4, 2, 1, 3, 5, 6, 2, 3, 7, 3, 0, 9, 5, 1
> 
> I moved the sqrt(2) call to the head of the method chain, then visualized
> elements using the `.raku` method (`.perl` works also, but don't tell
> anyone). You can see an empty element at the beginning/end, as well as
> where the decimal point used to reside. Including :skip-empty in your
> `.split` call sets it to True, removing empty elements.
> 
> For Mac/Linux people (swapped single/double quotes):
> 
> ~$ raku -e 'say sqrt(2).split(/\.|""/);'
> ( 1  4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1 )
> ~$ raku -e 'say sqrt(2).split(/\.|""/).raku;'
> ("", "1", "", "4", "1", "4", "2", "1", "3", "5", "6", "2", "3", "7", "3",
> "0", "9", "5", "1", "").Seq
> ~$ raku -e 'say sqrt(2).split(/\.|""/, :skip-empty);'
> (1 4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1)
> ~$ raku -e 'say sqrt(2).split(/\.|""/, :skip-empty).join(", ");'
> 1, 4, 1, 4, 2, 1, 3, 5, 6, 2, 3, 7, 3, 0, 9, 5, 1
> 
> HTH, Bill.
> 
> On Sun, Oct 31, 2021 at 5:51 AM sisyphus  wrote:
> >
> >
> >
> > On Sun, Oct 31, 2021 at 10:10 PM ToddAndMargo via perl6-users <
> perl6-users@perl.org> wrote:
> >>
> >> On 10/31/21 01:43, Shlomi Fish wrote:
> >>
> >> >
> >> >> ("" ~ sqrt(2)).comb().grep(* ne ".").map(+*)
> >> > (1 4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1)
> >>
> >> Cool!
> >>
> >> my Int @x = ("" ~ sqrt(2)).comb().grep(* ne ".").map(+*)
> >> [1 4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1]
> >>
> >> Is there a way to set how many digits I get?
> >
> >
> > In perl we can do:
> > C:\>perl -e "@x = split(/\.|/, sqrt(2)); print for @x";
> > 14142135623731
> > C:\>perl -e "@x = split(/\.|/, sprintf('%.7g', sqrt(2))); print for @x";
> > 1414214
> > C:\>perl -e "@x = split(/\.|/, sprintf('%.8g', sqrt(2))); print for @x";
> > 14142136
> >
> > But the same split() expression is unacceptable to Raku.
> > Closest I could get with that approach:
> >
> > C:\>raku -e "say split(/\.|''/, sqrt 2);"
> > ( 1  4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1 )
> >
> > C:\_32>raku -e "say split(/\.|''/, sprintf('%.5g', sqrt 2));"
> > ( 1  4 1 4 2 )
> >
> > It's that additional space between the first 2 digits that has me beat.
> > (I don't know raku at all.)
> >
> > Cheers,
> > Rob
> >
> >


Re: intermixed types and resulting types

2021-08-21 Thread Patrick R. Michaud
On Sat, Aug 21, 2021 at 12:50:21PM -0700, Joseph Brenner wrote:
> But then, in a case like this one, how would you know in advance
> that it would work, without Just Trying It:
> 
>   my @monsters  = < godzilla grendel wormface blob >;
>   my $cool_monsters = < godzilla ghidra mothera >.Set;
> 
>   say @monsters.WHAT;  # (Array)
>   say $cool_monsters.WHAT; # (Set)
> 
>   my $just_monsters = @monsters (-) $cool_monsters;
>   say $just_monsters; # Set(blob grendel wormface)
> 
> A set difference operation seems to know what to do with arrays,
> without any explicit conversion steps.  I don't think you can get
> that just from studying the type graphs

More likely, the set difference operation tries to coerce both of its
operands into Sets, and arrays know how to make themselves into a Set
(via the .Set() method inherited from List).

It's much like the way the subtraction operator (&infix:<->) tries
to coerce its operands into Numeric types, by asking the operands to
return their "Numeric" value, or the way the concatenation operator
(&infix:<~>) coerces its arguments into Stringy types.

Pm


Re: callbacks with placeholder vars

2021-08-09 Thread Patrick R. Michaud
On Mon, Aug 09, 2021 at 01:00:52PM -0700, Joseph Brenner wrote:
> There's this much:
> 
> https://docs.raku.org/language/variables#index-entry-$$CIRCUMFLEX_ACCENT
> 
> > If you have self-declared a parameter using $^a once, you may refer to it 
> > using only $a thereafter.
> 
> But it doesn't go anywhere near far enough.   You *had better* to
> refer to it as $a or you'll get some very weird behavior, though only
> under some circumstances.

Just to clarify (because I'm not sure this is clear yet):

You get "weird" behavior if you try to use it in the $^a form in a nested 
block, because the language treats any caret variables in the nested block as 
being part of the signature definition for the nested block.

So, going to the original "if" example, writing

   { 
 if ($^a eq $^b) {
   "$^a";
 } else {
   "$^a & $^b";
 }
   }

is akin to writing

   -> $a, $b {
 if ($a eq $b) -> $a {
   "$a";
 } else -> $a, $b {
   "$a & $b";
 }
   }

Each of the nested blocks is effectively defining a local $a (and $b), and the 
error is because the else clause sends only one argument to the block where two 
are expected.

The if statement and its clauses receive the result of the comparison as 
arguments to the nested blocks, if I remember correctly.  This is why "else" 
sends only one argument to its nested block.

Hope this helps a bit,

Pm
  


Re: [naive] hash assingment

2021-07-14 Thread Patrick R. Michaud
On Wed, Jul 14, 2021 at 07:41:14PM +, Daniel Sockwell wrote:
> (Also, you may already know this, but when the keys of your hash are 
> strings, you can write %a instead of %a{'column1'}  )

A minor nit: this only works if the string keys don't contain whitespace.
(The single angle bracket postfixes use the same parsing rules as qw().)

Pm


Re: I need help with ~~m/

2021-01-30 Thread Patrick R. Michaud
On Sat, Jan 30, 2021 at 05:52:54PM -0800, Joseph Brenner wrote:
> Which means there's some potential confusion if you really need
> to match quotes:
> 
> my $str = 'string_632="The chicken says--", voice="high"';
> 
> say
>   $str ~~ m:g{ ( " .*? " ) };   # False
> say
>   $str ~~ m:g{ ( \" .*? \" ) };  # let's feed [...]

FWIW, it's also possible to quote the quotes:

  say
$str ~~ m:g{ ( '"' .*? '"' ) }

Pm


Re: for and ^ question

2021-01-01 Thread Patrick R. Michaud
On Fri, Jan 01, 2021 at 05:41:04PM -0800, ToddAndMargo via perl6-users wrote:
> On 1/1/21 6:32 AM, David Santiago wrote:
> > say $_ for {0.1+$_}...^5
> 
> Is there a way to do this without the finger wagging?
> 
> say $_ for {0.1+$_}...^2

If you're going to a sequence operator ("...") instead of a range operator 
(".."), then you can specify the increment this way and it may be more readable:

   > say $_ for 0.1, 0.2 ...^ 2;

Raku will auto-deduce the sequence from the values in the list on the LHS of 
the sequence operator:

   > say $_ for 0.6, 1.1 ...^ 10;

This can be of course extended -- to count from $a up to $b in steps of $x, one 
can write:

   > say $_ for $a, $a+$x ...^ $b

Note that in these examples the caret is part of the sequence operator, it's 
not a prefix to the $b argument.

Pm


Re: Missing NullPointerException

2020-12-01 Thread Patrick R. Michaud
The difference is between the result of "Nil.c"  and "Any.c".

On my current version of Rakudo, "Nil.c" returns Nil, while Any.c throws the 
"No such method" exception.  In fact, Nil.any_non_existent method always seems 
to return Nil.  I'm not sure where this is documented, but it's likely the 
reason you don't get an error with "a.b.c".

In your example code, "a.b" returns Nil, so "a.b.c" invokes "Nil.c" which 
results in Nil and no error.

However, assigning Nil to a scalar reverts it to the type otject -- in this 
case Any.  Thus with

   my $b = a.b;

the Nil value coming from "a.b" causes $b to revert to its type object (Any).  
Then "$b.c" is the same as "(Any).c", which results in the "No such method" 
exception.

See the docs at https://docs.raku.org/type/Nil , in the section that talks 
about what happens when Nil is assigned to a container.

Hope this helps,

Pm


On Tue, Dec 01, 2020 at 08:34:31AM +0100, Konrad Bucheli via perl6-users wrote:
> Hi
> 
> I miss an error on my first invocation of `c` below:
> 
> $ raku
> Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2020.10.
> Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
> Built on MoarVM version 2020.10.
> 
> To exit type 'exit' or '^D'
> > class a { method b {return}}
> (a)
> > say a.b.c
> Nil
> > my $b = a.b
> (Any)
> > say $b.c
> No such method 'c' for invocant of type 'Any'
>   in block  at  line 1
> 
> >
> 
> Is there an explanation for that behavior?
> 
> Cheers
> 
> Konrad
> 


Re: Brace interpolation in strings creates a new scope?

2020-10-26 Thread Patrick R. Michaud
On Mon, Oct 26, 2020 at 08:04:21PM +0100, Elizabeth Mattijsen wrote:
> > On 26 Oct 2020, at 18:40, Sean McAfee  wrote:
> > Is this the intended behavior?  The doc page on quoting constructs 
> > just says that values can be interpolated with braces, but (at least 
> > to my eyes) doesn't suggest that this involves creating a new scope, 
> > or a new function, or however it is that this happens.
> 
> I guess we need to update the documentation.  But the braces inside a 
> double quoted string *do* create a new scope, causing the behaviour of 
> ++$ that you have seen.

In general Raku tries to avoid special cases... so I think that braces pretty 
much _always_ introduce a new scope.  I can't think of any exceptions at the 
moment, except for *maybe* when they are used as a hash constructor.  (And 
perhaps not even there.)

Of course I could be mistaken in this... but as a general rule, in language 
design there's been an effort to keep things consistent so that we don't have 
to say things like "braces create a new scope except when used in string 
interpolation" etc.

Pm


Re: "ICU - International Components for Unicode"

2020-09-25 Thread Patrick R. Michaud
On Fri, Sep 25, 2020 at 12:37:49PM +0200, Elizabeth Mattijsen wrote:
> > On 25 Sep 2020, at 04:25, Brad Gilbert  wrote:
> > Rakudo does not use ICU
> > 
> > It used to though.
> > 
> > Rakudo used to run on Parrot.
> > Parrot used ICU for its Unicode features.
> 
> I do remember that in the Parrot days, any non-ASCII character in 
> any string, would have a significant negative effect on grammar parsing.  
> This was usually not that visible when trying to run a script, but the 
> time needed to compile the core setting (which already took a few minutes 
> then) rose (probably exponentially) to: well, I don't know.  

Part of this is because Parrot/ICU was using UTF-8 and/or UTF-16 to
encode non-ASCII strings.  As a result, indexing into a string often 
became a O(n) operation instead of O(1).  For short strings, no problem,
for long strings (such as the core setting) it was really painful.

We did work on some ways in Parrot/NQP to reduce the amount of string
scanning involved, such as caching certain index-points in the string, 
but it was always a bit of a hack.  Switching to a fixed-width encoding
(NFG, which MoarVM implements) was definitely the correct path to take
there.

Pm


Re: junctions and parenthesis

2020-06-21 Thread Patrick R. Michaud
The "any" function is just like any other function taking an arbitrary list of 
arguments (including user-defined functions).  As such it parses with lower 
precedence than comparison operators -- so "eq" binds more tightly than "any".

Thus

   say so any  eq any ;

parses like

   say(so(any( eq any(;

which is indeed False.

I'm not exactly sure what sort of warning should go here, or how it'd be 
detected.  But perhaps others have ideas.  

Pm


On Sun, Jun 21, 2020 at 07:00:23PM -0700, Joseph Brenner wrote:
> I was just playing around with junctions a bit today, and I
> noticed that if you weren't religious about using parenthesis
> with them you could get quietly tripped up:
> 
> say so any() eq any();   # True   (as expected)
> say so any() eq any(); # False  (as expected)
> say so any  eq any ; # False(something's wrong)
> 
> Basically, you need the parens on that first use of any.
> 
> Is there a reason you don't at least get a warning if you don't?


Re: I need help sorting a list

2020-05-24 Thread Patrick R. Michaud
On Mon, May 25, 2020 at 12:07:22AM +0200, Tobias Boege wrote:
>   @things.sort: {
>   .comb(/ \d+ | \D+ /)
>   .map({ .Int // .self })
>   }


Or how about even somethig like

   @things.sort: *.Version;

which does handle a reasonable set of version semantics...?

(The .Version method was apparently added in 2020.01.)

Pm


Re: Help with grammar

2020-05-21 Thread Patrick R. Michaud
On Thu, May 21, 2020 at 08:40:08PM +, David Santiago wrote:
> Can someone explain me why my grammar isn't working? Unfortunately i
> can't figure it out :-(
> 
> |  headers
> |  |  header
> |  |  * MATCH "Proxy-Connection"
> |  |  header-value
> |  |  * MATCH "keep-alive\n"
> |  |  crlf
> |  |  * FAIL
> |  * FAIL
> * FAIL
> Nil

Notice how  is capturing the newline in "keep-alive\n"?  That 
means there's not a newline for the <.crlf> subrule that follows, and thus the 
match fails.

Try changing "rule header-value" to be a "token" instead.  That will prevent it 
from consuming any whitespace immediately following the + sequence.  
When I tried your script with header-value defined as a token, it got a lot 
farther into the match:

  $ rakudo test.raku
  TOP
  |  request-line
  |  |  method
  |  |  * MATCH "CONNECT"
  |  |  request-uri
  |  |  * MATCH "ssl.gstatic.com:443"
  |  |  http-version
  |  |  * MATCH "HTTP/1.1"
  |  |  crlf
  |  |  * MATCH "\n"
  |  * MATCH "CONNECT ssl.gstatic.com:443 HTTP/1.1\n"
  |  headers
  |  |  header
  |  |  * MATCH "Proxy-Connection"
  |  |  header-value
  |  |  * MATCH "keep-alive"
  |  |  crlf
  |  |  * MATCH "\n"
  |  * MATCH "Proxy-Connection: keep-alive\n"
  * MATCH "CONNECT ssl.gstatic.com:443 HTTP/1.1\nProxy-Connection: keep-"
  Nil


Personally, I would likely define  to be something more like

token header-value { \N+ }

which gets any sequence of non-newline characters, since some of the headers 
coming afterwards contain spaces and characters which aren't part of .

Pm


Re: Different return values with "say" vs "put" (Nil representation... )

2020-05-18 Thread Patrick R. Michaud
"say $x" is essentially equivalent to "put $x.gist".

Since Nil is undefined (roughly equivalent to a type object), Nil.gist has a 
string value of "Nil" and can be printed.  However, attempting to convert Nil 
directly into a Str throws an error because that's attempting to stringify an 
undefined object.

You can see this with the following:

$ rakudo
To exit type 'exit' or '^D'
> say Nil
Nil
> put Nil
Use of Nil in string context
  in block  at  line 1
> say Nil.Str
Use of Nil in string context
  in block  at  line 1
> put Nil.gist
Nil

So, the difference in your example is that when the result of s/.../.../ is Nil 
(representing a failed Match), C calls .gist on Nil which produces a 
printable string, while C attempts to stringify the Nil object directly 
and that throws an error.

Pm

On Sun, May 17, 2020 at 11:59:18PM -0700, William Michels via perl6-users wrote:
> Hello,
> 
> I'm interested in knowing the differences between the return values
> when "say" is used compared to "put". My understanding is that "put"
> returns Raku's internal representation of a value held by a variable,
> while "say" is merely "put" with the .gist method called on it (a
> "human readable", often-abbreviated return value).
> 
> Below I do "S///" (non-destructive) and "s///" (destructive) text
> replacement on a three line text file in bash line [1]. In bash line
> [2], the full substituted text file is correctly returned; in bash
> line [3] using "say" only the $/ match string is returned. So far so
> good. However, a virtually-identical call in bash line [4] using "put"
> instead of "say" returns an error for the first line of the target
> text file: "Use of Nil in string context in block  at -e line 1".
> 
> [1] homedir$ cat demo1.txt
> this is a test,
> I love Unix,
> I like Linux too,
> 
> [2] homedir$ perl6 -ne 'say S/love|like/admire/;' demo1.txt
> this is a test,
> I admire Unix,
> I admire Linux too,
> 
> [3] homedir$ perl6 -ne 'say s/love|like/admire/;' demo1.txt
> Nil
> 「love」
> 「like」
> 
> [4] homedir$ perl6 -ne 'put s/love|like/admire/;' demo1.txt
> Use of Nil in string context
>   in block  at -e line 1
> 
> love
> like
> 
> [5] homedir$
> 
> I'm really trying to understand this error message:  doesn't Raku know
> that this is a text replacement operation? How can a 'Nil' be
> correctly represented when called by "say", but throw an error when
> called by "put"? If the value is absent at the Raku representational
> level and throws an error, wouldn't it be reasonable to assume that
> the same case would hold for "say"? And finally, does this "say / put"
> difference mean that some textual information will be lost from return
> values (because "say" will have to be used instead of "put" to avoid
> errorring-out)?
> 
> Any enlightenment appreciated,
> 
> TIA, Bill.


Re: Metamethods: WHERE

2020-02-12 Thread Patrick R. Michaud
On Wed, Feb 12, 2020 at 10:27:20AM -0300, Aureliano Guedes wrote:
> So, I'd like to find a way to test if two variables are bound or not,
> especially concerning their memory address.
> 
> If the address is not fixed for a lifetime, I must be able to test it in
> just one cycle.
> > $a.WHERE == $b.WHERE   # I expected FALSE
> True
> 
> To a bound variable, I expect the same address, but to an unbounded
> variable, this garbage collector behavior seams assing to the same memory
> location two unbounded variables with the same value. It is right? Must
> reduce memory usage but is a quiet weirdo.

I don't know that it's "weirdo" that two variables containing the same 
(constant, immutable) value end up at the same address.  It's just the compiler 
treating constants as proper objects and being smart about memory allocation.

In particular:

> my $a = 3; say $a.WHERE
94659198947472
> $a = 4; say $a.WHERE
94659198947432
> $a = 3; say $a.WHERE
94659198947472

What's likely happened is that the compiler has created an Int representing the 
constant "3", and keeps track of that for future compilations.  Whenever the 
compiler encounters another "3", rather than build a new Int object in memory 
it re-uses the Int it already established if it can.

So, with

> my $b = 3; say $b.WHERE
94659198947472

The compiler lets $b use the same constant 3 object that was created the first 
time it was encountered, even though $a coincidentally also uses it.

> $b = 6 div 2;  say $b; say $b.WHERE
3
139719166700504

The compiler has gone ahead and used "6 div 2" to produce a new Int object, 
which has the same value as the constant 3 but is in a different memory 
location.  If we then do

> $b = 3; say $b.WHERE
94659198947472

you can see that the constant "3" Int is still hanging around to be used 
wherever it's later mentioned in the code.

Hope this helps,

Pm


Re: Substr behaviour with CRLF

2020-02-10 Thread Patrick R. Michaud
Because Str is treated as a set of graphemes, and "\r\n" is treated as a single 
character, .substr() is doing the right thing here.

If you really want to treat it as a series of codepoints, you may want to go 
through Blob/Buf to get there:

> "1234\r\n78".encode.subbuf(*-4)
utf8:0x<0D 0A 37 38>
> "1234\r\n78".encode.subbuf(*-4).decode

78

Pm


On Mon, Feb 10, 2020 at 02:38:19PM -0500, Paul Procacci wrote:
> Unicode conformance requires "\r\n" to be interpreted as \n alone.
> With that said; no, I don't not know how to turn this off.
> 
> I personally think I'd consider this a bug.  If not a bug, greater
> documentation efforts that explain this.
> The display routines (say / print) don't modify the string on output, yet
> the other string handling routines do.
> 
> We'd need further clarification from the devs as I don't have a full grasp
> of the design decision for this problem.
> 
> On Mon, Feb 10, 2020 at 11:28 AM David Santiago  wrote:
> 
> > A 10 de fevereiro de 2020 16:57:55 CET, David Santiago 
> > escreveu:
> > >
> > >
> > >Hi!
> > >
> > >Is there a way to change the the following behaviour, so it considers
> > \r\n as two characters when using substr, instead of one?
> > >
> > >On raku version 2019.11
> > >
> > >> "1234\r\n". substr(*-4)
> > >4
> > >78
> > >> "1234\r\n". substr(*-4).ords()
> > >(52 13 10 55 56)
> > >
> > >
> > >Best regards,
> > >David Santiago
> > >
> >
> > Copied wrong the example:
> >
> > It should be:
> >
> > On raku version 2019.11
> >
> > > "1234\r\n78". substr(*-4)
> > 4
> > 78
> > > "1234\r\n78". substr(*-4).ords()
> > (52 13 10 55 56)
> >
> >
> >
> > --
> > Sent from my Android device with K-9 Mail. Please excuse my brevity.
> >
> 
> 
> -- 
> __
> 
> :(){ :|:& };:


Re: while(<>){...} analog?

2019-07-29 Thread Patrick R. Michaud
My guesses at Perl 6 versions of the Perl 5 example:

   say .split(':')[0, 2, 1, 5].join("\t") for lines;

-or-

   for lines { say .split(':')[0, 2, 1, 5].join("\t") }

Pm


On Mon, Jul 29, 2019 at 12:49:51PM -0700, William Michels via perl6-users wrote:
> Hello, Just a short backgrounder to say that this question arose this
> past weekend at a Perl6 Meetup (Oakland, CA). Specifically we were
> looking at how to write a Perl6 version of some introductory Perl5
> code in "Learning Perl", 7th Edition by Tom Phoenix, brian d foy,
> Randal L. Schwartz:
> 
> #Perl 5 code below:
> while (<>) {
>   chomp;
>   print join("\t", (split /:/)[0, 2, 1, 5] ), "\n";
> }
> 
> https://www.oreilly.com/library/view/learning-perl-7th/9781491954317/ch01.html
> 
> (Thanks to Joseph Brenner for organizing the Perl6 Meetup).
> 
> 
> 
> 
> 
> 
> On Mon, Jul 29, 2019 at 2:09 AM Elizabeth Mattijsen  wrote:
> >
> > Also, you can make this conditional:  show me all the comment lines of a 
> > source file:
> >
> >
> > $ perl6 -e '.say if .starts-with('#') for lines' source-file
> >
> >
> > > On 29 Jul 2019, at 10:06, Richard Hainsworth  
> > > wrote:
> > >
> > > Also no need for all the brackets
> > >
> > > .say for lines;
> > >
> > > This is quite idiomatic Perl 6 and not golfing
> > >
> > > On Mon, 29 Jul 2019, 07:13 Joseph Brenner,  wrote:
> > > > Hmmm. I would expect that to be in the Perl 5 to Perl 6 Migration 
> > > > Guides, but I do not see it there.
> > >
> > > Exactly, I was just looking there, and I ended up playing around with
> > > the method form of lines, and didn't think to try the function
> > > form of it.
> > >
> > > To summarize, if the goal is to write a "simple_echo" script that
> > > can work with a file name or with lines on standard input:
> > >
> > >simple_echo lines.txt
> > >cat lines.txt | simple_echo
> > >
> > > The perl5 version would probably be:
> > >
> > >   #!/usr/bin/env perl
> > >   while(<>){
> > >  print;
> > >   }
> > >
> > > The perl6 version would be something like:
> > >
> > >   #!/usr/bin/env perl6
> > >   use v6;
> > >   for lines() {
> > >   say $_;
> > >   }
> > >
> > >
> > > The kind of thing I was playing with was:
> > >
> > >   #!/usr/bin/env perl6
> > >   use v6;
> > >   my @lines = $*ARGFILES.IO.lines;
> > >   say @lines;
> > >
> > > That works for lines from a file, but not from standard input, and  the
> > > error message isn't tremendously helpful:
> > >
> > >   No such method 'lines' for invocant of type 'IO::Special'
> > >
> > >
> > >
> > >
> > > On 7/28/19, Bruce Gray  wrote:
> > > >
> > > >
> > > >> On Jul 28, 2019, at 6:20 PM, Joseph Brenner  wrote:
> > > >>
> > > >> I was just wondering if there's some direct analog in perl6 to the
> > > >> perl5 construct:
> > > >>
> > > >>  while(<>){ ... }
> > > >>
> > > >> If I'm planning on passing a filename on the command-line, I can just
> > > >> get it out of $*ARGFILES easily enough, but what if I also wanted it
> > > >> to work on lines passed in via standard input?
> > > >
> > > >
> > > > `lines` , as a sub instead of a method, and no arguments.
> > > >
> > > > See: https://docs.perl6.org/routine/lines#(Cool)_routine_lines
> > > >   Without any arguments, sub lines operates on $*ARGFILES, which 
> > > > defaults to
> > > > $*IN in the absence of any filenames.
> > > >
> > > > For example:
> > > >   perl6 -e 'say .join("\t") for lines().rotor(4);' path/to/file.txt
> > > >
> > > > Hmmm. I would expect that to be in the Perl 5 to Perl 6 Migration 
> > > > Guides,
> > > > but I do not see it there.
> > > >
> > > > —
> > > > Hope this helps,
> > > > Bruce Gray (Util of PerlMonks)
> > > >
> > > >


Re: Need help with a regex

2019-05-07 Thread Patrick R. Michaud
The (.*?) pattern will match an empty string.  

Thus $0 gets the dollar sign, $1 is "", and "$" ~ "" (i.e., "$") gets replaced 
by "" ~ "USD"  (i.e., "USD").

So the net result is to replace the single dollar sign by "USD", resulting in 
"USD1.23".

You might want to remove the ? modifier from .*?, so that the expresssion is 
greedy instead of eager.

Pm


On Mon, May 06, 2019 at 07:12:39PM -0700, Tony Ewell via perl6-users wrote:
> Hi All,
> 
> What am I doing wrong here?
> 
> $ p6 'my $x="\$1.23"; $x~~s/("\$") (.*?)/$1USD/; say $x;'
> USD1.23
> 
> I am expecting to see  `1.23USD`
> 
> Many thanks,
> -T


Re: split and nils?

2019-02-06 Thread Patrick R. Michaud
On Wed, Feb 06, 2019 at 12:38:01PM -0800, ToddAndMargo via perl6-users wrote:
> $ p6 'my Str $x="abcd"; for $x.comb.kv -> $i, $j {say "Index <$i> = <$j> =
> ord <" ~ ord($j) ~ ">";}'
> 
> Index <0> =  = ord <97>
> Index <1> =  = ord <98>
> Index <2> =  = ord <99>
> Index <3> =  = ord <100>
> 
> Certainly very practical.  If dealing with large strings, is
> it the most efficient?

.comb is intended to be more efficient than .split for this particular 
application, yes.

"comb" is about obtaining the substrings you're looking for (individual 
characters in this case); "split" is about finding substrings between the 
things you're looking for.

Pm


Re: Grammar doesn't seem to match any token

2018-09-23 Thread Patrick R. Michaud
I suspect the rule:

rule other { .  }

means that in

$input = '~i << to 
match (although  will also end up matching the space after the "i" in 
the text string, since white spaces are no longer significant).  Or try just 
changing the  rule to be a token and leave the others as rules.

Phrased another way, the  rule as written now is roughly equivalent to 
writing

   token other { .  \s* }

which will match a word character only when it's not immediately followed by 
another word character.

Pm


On Sun, Sep 23, 2018 at 08:01:31PM -0400, yary wrote:
> Let's see.
> 
> If you have my $input = '~i o<<<', then  matches.
> 
>  'rule' turns on :sigspace. If you use 'token' instead of 'rule' then
>  matches.
> 
> I don't quite have the full picture of what's happening.
> 
> -y
> 
> On Sun, Sep 23, 2018 at 7:07 PM, Mark Carter  wrote:
> 
> > My grammar doesn't seem to match the 'other' rule. What's wrong with it?
> >
> > grammar Weave {
> > token TOP {   * }
> > rule el {   |  |   }
> > rule lt { '<'  }
> > rule tilde { '~' \S+ }
> > rule other { .  }
> > }
> >
> > class Weaver {
> > has Str $.outstr;
> >
> > method TOP   ($/) { make $ ; put("top called") ; put($) }
> > method el($/) { put($/) }
> > method tilde ($/) { say 'tilde called' }
> > method lt($/) { make '<' ; put('<'); $!outstr ~= 'X' }
> > method other ($/) { $!outstr ~= '.'; say 'other called'; put('.');
> > }
> >
> > }
> >
> > $input = '~i << > my $w = Weaver.new();
> > Weave.parse($input, :actions($w));
> > say $w.outstr; # outputs XXX
> >
> > It never once says 'other called'. It seems to be matching the '<' signs
> > OK, and I think the '~' is OK, too. It's just any other token that it's not
> > matching.
> >


Re: Catching exceptions in expressions

2018-08-03 Thread Patrick R. Michaud
Yes; but then I think that something like infix: probably just ends up 
as a macro somehow.  I just didn't know the state of macros in Perl 6 well 
enough to be able to head down that route.  :)

Pm

On Fri, Aug 03, 2018 at 10:32:41PM +0200, Elizabeth Mattijsen wrote:
> Sometimes I wish we could use Thunk as a type:
> 
> sub infix:(Thunk:D $block, $otherwise) { }
> 
> which would then allow you to do:
> 
> my $sixdivzero = divide(6,0) rescue -1;  # note absence of curlies
> 
> 
> 
> One can wish, can’t one?
> 
> 
> Liz
> 
> > On 3 Aug 2018, at 22:18, Patrick R. Michaud  wrote:
> > 
> > Maybe something like...?
> > 
> > $ cat t.p6
> > 
> > sub infix:(Callable $block, $otherwise) { 
> >   CATCH { return $otherwise; }
> >   $block();
> > }
> > 
> > sub divide($a, $b) { die "Zero denominator" if $b == 0; $a / $b }
> > 
> > my $sixdivzero = { divide(6,0) } rescue -1;
> > say "6/0 = ", $sixdivzero;
> > 
> > my $sixdivtwo = { divide(6,2) } rescue -1;
> > say "6/2 = ", $sixdivtwo;
> > 
> > 
> > $ perl6 t.p6
> > 6/0 = -1
> > 6/2 = 3
> > 
> > 
> > Or if you prefer a prefix form, just declare "rescue" as a normal sub and 
> > then do:
> > 
> >   rescue { divide(6,2) }, -1;
> > 
> > Pm
> > 
> > On Fri, Aug 03, 2018 at 08:34:44PM +0100, Simon Proctor wrote:
> >> Hi Sean. I hope my second answer in stackoverflow gets closer to what you
> >> want.
> >> 
> >> I am still trying to think of a more idiomatic way of handling to 
> >> situation.
> >> 
> >> 
> >> 
> >> On Fri, 3 Aug 2018, 19:29 Sean McAfee,  wrote:
> >> 
> >>> I posted about this subject on Stack Overflow yesterday[1], but I chose a
> >>> poor example of something that raises an exception (dividing by zero, 
> >>> which
> >>> apparently doesn't necessarily do so) on which the answers have mostly
> >>> focused.
> >>> 
> >>> I was looking for a way to evaluate an expression, and if the expression
> >>> threw an exception, for a default value to be provided instead.  For
> >>> example, in Ruby:
> >>> 
> >>>quotient = begin; a / b; rescue; -1; end
> >>> 
> >>> Or in Lisp:
> >>> 
> >>>(setq quotient (condition-case nil (/ a b) (error -1)))
> >>> 
> >>> Not having written much exception-related code in Perl 6, I hoped that
> >>> this might work:
> >>> 
> >>>sub divide($a, $b) { die "Zero denominator" if $b == 0; $a / $b }
> >>>my $quotient = do { divide($a, $b); CATCH { default { -1 } } };
> >>> 
> >>> It doesn't, though.  As far as I can tell, the value to which a CATCH
> >>> block evaluates is ignored; the only useful things one can do in such a
> >>> block are things with side effects.  Long story short, I eventually came 
> >>> up
> >>> with this:
> >>> 
> >>>my $quotient = do { my $q; { $q = divide($a, $b); CATCH { default { $q
> >>> = -1 } } }; $q };
> >>> 
> >>> That's far more verbose than I've come to expect from Perl 6.  Is there
> >>> some more concise way of expressing this logic?
> >>> 
> >>> The doc page on exceptions mentions try, eg:
> >>> 
> >>>my $quotient = try { divide($a, $b) } // -1;
> >>> 
> >>> That works in this specific case, but it seems insufficient in general.
> >>> The function might validly return an undefined value, and this 
> >>> construction
> >>> can't distinguish between that and an exception.  Also, it wouldn't let me
> >>> distinguish among various exception cases.  I'd have to do something like:
> >>> 
> >>>class EA is Exception { }
> >>>class EB is Exception { }
> >>>sub divide($a, $b) { (EA, EB).pick.new.throw if $b == 0; $a / $b }
> >>> 
> >>>my $quotient = do { my $q; { $q = divide($a, $b); CATCH { when EA { $q
> >>> = -1 }; when EB { $q = -2 } } }; $q };
> >>> 
> >>> 
> >>> [1]
> >>> https://stackoverflow.com/questions/51644197/returning-values-from-exception-handlers-in-perl-6/51670573
> >>> 
> >> -- 
> >> Simon Proctor
> >> Cognoscite aliquid novum cotidie


Re: Catching exceptions in expressions

2018-08-03 Thread Patrick R. Michaud
Maybe something like...?

$ cat t.p6

sub infix:(Callable $block, $otherwise) { 
   CATCH { return $otherwise; }
   $block();
}

sub divide($a, $b) { die "Zero denominator" if $b == 0; $a / $b }

my $sixdivzero = { divide(6,0) } rescue -1;
say "6/0 = ", $sixdivzero;

my $sixdivtwo = { divide(6,2) } rescue -1;
say "6/2 = ", $sixdivtwo;


$ perl6 t.p6
6/0 = -1
6/2 = 3


Or if you prefer a prefix form, just declare "rescue" as a normal sub and then 
do:

   rescue { divide(6,2) }, -1;

Pm

On Fri, Aug 03, 2018 at 08:34:44PM +0100, Simon Proctor wrote:
> Hi Sean. I hope my second answer in stackoverflow gets closer to what you
> want.
> 
> I am still trying to think of a more idiomatic way of handling to situation.
> 
> 
> 
> On Fri, 3 Aug 2018, 19:29 Sean McAfee,  wrote:
> 
> > I posted about this subject on Stack Overflow yesterday[1], but I chose a
> > poor example of something that raises an exception (dividing by zero, which
> > apparently doesn't necessarily do so) on which the answers have mostly
> > focused.
> >
> > I was looking for a way to evaluate an expression, and if the expression
> > threw an exception, for a default value to be provided instead.  For
> > example, in Ruby:
> >
> > quotient = begin; a / b; rescue; -1; end
> >
> > Or in Lisp:
> >
> > (setq quotient (condition-case nil (/ a b) (error -1)))
> >
> > Not having written much exception-related code in Perl 6, I hoped that
> > this might work:
> >
> > sub divide($a, $b) { die "Zero denominator" if $b == 0; $a / $b }
> > my $quotient = do { divide($a, $b); CATCH { default { -1 } } };
> >
> > It doesn't, though.  As far as I can tell, the value to which a CATCH
> > block evaluates is ignored; the only useful things one can do in such a
> > block are things with side effects.  Long story short, I eventually came up
> > with this:
> >
> > my $quotient = do { my $q; { $q = divide($a, $b); CATCH { default { $q
> > = -1 } } }; $q };
> >
> > That's far more verbose than I've come to expect from Perl 6.  Is there
> > some more concise way of expressing this logic?
> >
> > The doc page on exceptions mentions try, eg:
> >
> > my $quotient = try { divide($a, $b) } // -1;
> >
> > That works in this specific case, but it seems insufficient in general.
> > The function might validly return an undefined value, and this construction
> > can't distinguish between that and an exception.  Also, it wouldn't let me
> > distinguish among various exception cases.  I'd have to do something like:
> >
> > class EA is Exception { }
> > class EB is Exception { }
> > sub divide($a, $b) { (EA, EB).pick.new.throw if $b == 0; $a / $b }
> >
> > my $quotient = do { my $q; { $q = divide($a, $b); CATCH { when EA { $q
> > = -1 }; when EB { $q = -2 } } }; $q };
> >
> >
> > [1]
> > https://stackoverflow.com/questions/51644197/returning-values-from-exception-handlers-in-perl-6/51670573
> >
> -- 
> Simon Proctor
> Cognoscite aliquid novum cotidie


Re: need regex help

2018-08-03 Thread Patrick R. Michaud
The + essentially indicates that this is a character-class match.  It's to 
distinguish things from <.alpha>, , , <-alpha>, and  
(among others).

Pm

On Fri, Aug 03, 2018 at 08:48:24PM +0200, Timo Paulssen wrote:
> The + is required, perhaps because the first character after the opening
> < is supposed to determine exactly what thing it is? Not sure about
> that. The + and - is a bit like "start at nothing, add all alnums, then
> subtract all alphas". The + after the < > is just to match it any number
> of times, but at least once, and the $ at the end, together with the ^
> at the start, ensures that every character in the string has to match,
> not just any character.
> 
> Hope that makes sense
>   - Timo
> 
> 
> On 03/08/18 20:04, ToddAndMargo wrote:
> > On 08/02/2018 05:18 AM, Timo Paulssen wrote:
> >> Is this what you want?
> >>
> >> perl6 -e 'say "12345" ~~ /^<+alnum -alpha>+$/'
> >> 「12345」
> >>
> >> perl6 -e 'say "123a45" ~~ /^<+alnum -alpha>+$/'
> >> Nil
> >>
> >> HTH
> >>    - Timo
> >>
> >
> > What does the following do?
> >
> >  +alnum   (why does it need the "+"?)
> >  -alpha   (I presume "-" means negate?)
> >  +$
> >
> > Many thanks,
> > -T


Re: can't match unicode chars?

2018-07-31 Thread Patrick R. Michaud
On Tue, Jul 31, 2018 at 09:28:08PM +0200, Marc Chantreux wrote:
> @*ARGS.map: {
> gather {
> my @lines;
> for .IO.lines -> $l {
>if /'›'/ {
>@lines and take @lines;
>@lines = $l;
>}
>else {
>@lines.push($l);
>take @lines if /''/;
>}
> }
> }
> }
> 
> this doesn't work as it seems that '›' and '' aren't matched.

Is it as simple that the  /'›'/  regex is being matched against $_ instead of 
$l ?  

If I'm reading the above code correctly, $_ is being set to each of the values 
of @ARGS in turn.  The lines iterated by the for loop are all being bound to 
$l, meaning $_ is unchanged from its outer (map) meaning.

Pm


Re: -c bug to report

2018-07-25 Thread Patrick R. Michaud
On Wed, Jul 25, 2018 at 11:48:30AM -0700, ToddAndMargo wrote:
> Maybe I am trying to get "-c" to do too many things.
> 
> What I would like it to do is to check everything right up to but not
> actually run the program.

Part of the challenge here is that unlike many other programming languages, 
Perl 6 is designed to be very dynamic.  The compiler actually executes some 
components of the program as it scans them -- i.e., before it's had a chance to 
check (or even read) the entire source code file.  

So it's a little challenging in Perl 6 to say "but not actually run the 
program".  

A more accurate/do-able thing might be to simply say "load everything but don't 
run the mainline".  In code this could perhaps be achieved with something like:

   INIT { exit 0; }

This means that BEGIN and CHECK blocks still run, as well as potential other 
declarations that have executable side effects, but the mainline doesn't ever 
get run.  Perhaps there's a case to be made that "-c" or a similar option 
should do something like this, or have "-c" simply stop after the CHECK phase 
of evaluation.

Pm


Re: Need match character help

2018-05-20 Thread Patrick R. Michaud
On Sun, May 20, 2018 at 03:02:34PM -0700, ToddAndMargo wrote:
> On 05/20/2018 10:40 AM, Patrick R. Michaud wrote:
> > On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote:
> > > On 18/05/18 13:30, The Sidhekin wrote:
> > > > 
> > > >    / ^ <[d..z]>* $/
> > > 
> > > That's pretty good! Putting the beginning-of-string anchor ^ anywhere
> > > but the very start is surely an advanced move :)
> > 
> > FWIW, sometimes I think it's worth inverting the entire regex -- i.e., 
> > instead of matching finding things that do match, exclude the things that 
> > don't:
> > 
> > / gm | <-[d..z]> /
> > 
> > This regex will match any string containing the sequence "gm" or any 
> > character that isn't in the range "d".."z", which is the inverse of what 
> > was required (strings containing only "d".."z" and never "gm").  Then use 
> > !~~ or some similar logic to get the strings wanted.
> > 
> > I recognize that this approach might not fit well in all cases, but it's 
> > another (perhaps cleaner) approach to getting what's wanted.
> 
> Something is wrong.  "h" is in the exclude list.
> 
> $ p6 'if "hgm" ~~ / gm | <-[d..z]> / {say "y"} else {say "n"}'
> y

The string "hgm" is in the "not include" list for the other regex as well 
(because it contains "gm"):

$ perl6 -e 'if "hgm" ~~ /  ^ <[d..z]>* $/ { say "n" } else { say 
"y" }'
y


Pm


Re: Need match character help

2018-05-20 Thread Patrick R. Michaud
On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote:
> On 18/05/18 13:30, The Sidhekin wrote:
> >
> >   / ^ <[d..z]>* $/
> 
> That's pretty good! Putting the beginning-of-string anchor ^ anywhere
> but the very start is surely an advanced move :)

FWIW, sometimes I think it's worth inverting the entire regex -- i.e., instead 
of matching finding things that do match, exclude the things that don't:

   / gm | <-[d..z]> /

This regex will match any string containing the sequence "gm" or any character 
that isn't in the range "d".."z", which is the inverse of what was required 
(strings containing only "d".."z" and never "gm").  Then use !~~ or some 
similar logic to get the strings wanted.

I recognize that this approach might not fit well in all cases, but it's 
another (perhaps cleaner) approach to getting what's wanted.

Pm


Re: Any "note" without the "say"?

2017-09-15 Thread Patrick R. Michaud
On Fri, Sep 15, 2017 at 04:54:33PM -0400, Brandon Allbery wrote:
> On Fri, Sep 15, 2017 at 4:51 PM, ToddAndMargo  wrote:
> > On 09/15/2017 01:29 PM, Brandon Allbery wrote:
> >> Everyone does at one time :) It's really useful for debugging, but you
> >> generally strip it out of production code.
> >
> > I saw a business study somewhere (I don't remember where)
> > that determined that the notes folks doodle into the margins on
> > working papers are often time more useful than the papers
> > themselves.  One wonders how much of this happens in Perl!
> 
> That'd be comments, actually. Sadly, the same rule doesn't seem to apply;
> programmers are terrible at writing useful comments for the most part.

True, but when programmers do manage to write useful comments, they often turn 
out to be VERY useful.  :)

Pm


Re: Need awk print sub

2017-08-04 Thread Patrick R. Michaud
How about...

$ echo "a b c d" | ./perl6 -n -e '.words[1].say'
b

Pm

On Fri, Aug 04, 2017 at 01:00:52PM -0700, ToddAndMargo wrote:
> Hi All,
> 
> How do I do this with a perl one liner?
> 
> $ echo "a b c d" | awk '{print $2}'
> b
> 
> Many thanks,
> -T


Re: getting help in the REPL

2017-06-14 Thread Patrick R. Michaud
On Wed, Jun 14, 2017 at 04:00:05PM +0300, Gabor Szabo wrote:
> In the python interactive shell one can write dir(object)  and it
> lists the attributes and methods of the object. One can write
> help(object) and get the documentation of the object.
> Is there anything similar in Perl 6?

I think the original intent was for .WHY to work in this manner -- it's 
intended to provide the attached Pod value.

I don't know to what level Rakudo implements this yet.

There's an example given at https://docs.perl6.org/routine/WHY .

Pm


Re: Perl6 shell, Was: command auto-completion in perl6 shell

2017-05-31 Thread Patrick R. Michaud
On Wed, May 31, 2017 at 09:33:59AM -0400, Brock Wilcox wrote:
> One of my dreams is to adopt a client/server + middleware model from nREPL
> (clojure) which I think works really well, and likely to do that in
> userspace as a regular module. Moving everything into REPL.pm (perl6
> instead of nqp) lets us use de-facto interfaces and easily override it in a
> user module.

FWIW, the idea has always been that NQP provides a simple, default REPL for 
tools/languages being built using NQP, and then languages can then 
override/augment that REPL as desired.

Pm


Re: Invoking method by name found in variable

2017-05-23 Thread Patrick R. Michaud
On Tue, May 23, 2017 at 09:01:54PM +0300, Gabor Szabo wrote:
> given an object $o and the name of a method in $method = "run"
> how can I invoke the $o.run() ?
> 
> Something like $o.call($method)

At one point it was done as  $o."$method"() .

> my $method = 'say';  123."$method"();
123

Pm


Re: Parse a string into a regex?

2017-05-11 Thread Patrick R. Michaud
Since we went to a lot of trouble to get lexical and closures to work correctly 
in Perl 6, it seems fair to use it here:

$ cat rxstr
sub rxstr($s) { rx/<$s>/ }

my $str = 'foo';
my $foorx = rxstr($str);   # create /foo/ regex

say 'foo' ~~ $foorx;   # matches
$str = 'bar'; 
say 'foo' ~~ $foorx;   # still matches... $foorx is unchanged

$ ./perl6 rxstr
「foo」
「foo」

And for a bit more golfing, there's:

my $str = 'foo';
my $foorx = { rx/<$^a>/ }.($str);

say 'foo' ~~ $foorx;

Pm


On Fri, May 12, 2017 at 01:01:17AM +0200, Timo Paulssen wrote:
> The only way that comes to mind is to use EVAL, but that's not
> golf-friendly at all.
> 
> Perhaps you can find something sufficiently short based on .contains,
> .index, .starts-with, .ends-with, and friedns?


Re: maintainability and "or"

2017-03-21 Thread Patrick R. Michaud
On Tue, Mar 21, 2017 at 02:46:43PM -0400, Brandon Allbery wrote:
> On Tue, Mar 21, 2017 at 2:37 PM, Patrick R. Michaud 
> wrote:
> > > On Tue, Mar 21, 2017 at 7:38 AM, ToddAndMargo 
> > wrote:
> > > > $Name.IO.f or $Name.IO.open(:w).close;
> > >
> > > fwiw I consider this a perl3_to_5-ism; it's an optimization, and a fairly
> >
> > It's not entirely a perl3-to-5ism.  Using || and && for conditional
> > execution dates back to Unix shell programming (long before Perl existed);
> > Perl 5 introduced the low precedence "or"/"and" versions of the operators.
> 
> True, but I don't really consider shells to be full programming languages;
> they exist to glue external programs together. 

and FWIW, Perl was long known as a "glue language" as well.  :)

> If you have an actual programming language around, there's no reason to
> stick to unreadable JCL-ish constructs.

...unless you have a large audience of people that are fluent in those 
constructs and would like to continue using them in their shiny new programming 
environment.

Pm


Re: maintainability and "or"

2017-03-21 Thread Patrick R. Michaud
On Tue, Mar 21, 2017 at 02:25:02PM -0400, Brandon Allbery wrote:
> On Tue, Mar 21, 2017 at 7:38 AM, ToddAndMargo  wrote:
> > $Name.IO.f or $Name.IO.open(:w).close;
> 
> fwiw I consider this a perl3_to_5-ism; it's an optimization, and a fairly
> poor one for readability and maintainability, but one that used to be
> fairly important (people comparing perl 5 speed to perl 6 should take note:
> perl 5 used to be slow too).

It's not entirely a perl3-to-5ism.  Using || and && for conditional execution 
dates back to Unix shell programming (long before Perl existed); Perl 5 
introduced the low precedence "or"/"and" versions of the operators.

Pm


Re: RFE: throw an error on a single "="when used in an "if"

2017-03-20 Thread Patrick R. Michaud
On Mon, Mar 20, 2017 at 02:36:49PM +0100, Francesco Rivetti wrote:
> On 18. mars 2017 11:54, Elizabeth Mattijsen wrote:
> 
> > if (my $x = frobnicate(42)) {
> > say $x
> > }
> [...]
> > if frobnicate(42) -> $x {
> > say $x
> > }
> 
> which is way more elegant. Should this make it wise to have a compile time
> warning for the former then?

FWIW, the two snippets above are not exactly equivalent.  The scope of $x in 
the second version is limited to the block, while in the first version it 
extends beyond the if statement.

$ cat a1
if (my $x = abs(42)) { say $x; }
say "$x again";
$ ./perl6 a1
42
42 again

$ cat a2
if abs(42) -> $y { say $y; }
say "$y again";
$ ./perl6 a2
===SORRY!=== Error while compiling /home/pmichaud/p6/rakudo/a2
Variable '$y' is not declared
at /home/pmichaud/p6/rakudo/a2:2
--> say "⏏$y again";

While it might be appropriate to have a warning on simple assignment (as long 
as there's also a way to suppress the warning), I wouldn't want a warning on 
initialization, as in

if (my $x = ...) { ... }

In this case, the "my" makes it pretty clear that the assignment is intentional 
and not a typo. 

Pm


Re: for loop index question

2017-02-28 Thread Patrick R. Michaud
I think the canonical Perl 6 answer is:

for @array.kv -> $index, $value { do something }

Pm

On Tue, Feb 28, 2017 at 01:20:47PM -0800, ToddAndMargo wrote:
> Hi All,
> 
> There are times when I want to know th4e index of an array
> when I am in a "for @array" loop.  I can do it with a
> variable outside the for loop and increment it, but
> I would line to know know if there is a way to incorporate
> it in the loop command.
> 
> This is my long winded way of doing it in Perl 5:
> 
> while (my ($Index, $Element) = each ( @Sorted_List ) ) { do something }
> 
> 
> Many thanks,
> -T
> 
> 
> 
> -- 
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~


Re: Startup performance on OS X

2016-10-03 Thread Patrick R. Michaud
On Mon, Oct 03, 2016 at 04:26:10PM +0200, Elizabeth Mattijsen wrote:
> > On 02 Oct 2016, at 11:00, Thor Michael Støre  wrote:
> > Is this normal startup performance?
> 
> https://www.promptworks.com/blog/public-keys-in-perl-6
> 
> I wonder what would be needed to run this in Perl 5, module wise, and CPU 
> wise.

This also seems like an interesting task for Rosetta Code (the RSA key 
generation part).  

Rosetta Code already has an entry for RSA encryption/decryption in Perl 6 (but 
not Perl), but I'm wondering if the article's version is better than Rosetta 
Code's existing Perl 6 entry.

   http://rosettacode.org/wiki/RSA_code#Perl_6

Pm


Re: Startup performance on OS X

2016-10-02 Thread Patrick R. Michaud
On Sun, Oct 02, 2016 at 11:00:38AM +0200, Thor Michael Støre wrote:
> Thormicks-MacBook-Pro-3:~ thormick$ time perl6 -e "say 'foo'"
> foo
> 
> real  0m0.205s
> user  0m0.150s
> sys   0m0.045s
>
> [...]
> 
> Foo indeed! ~200ms for this seems awfully slow to me.

On another hand, my machine shows:

$ time perl -MMoose -E "say 'foo'"
foo

real0m0.190s
user0m0.172s
sys 0m0.012s

It feels like Perl 6 might at least be in the same ballpark as Perl 5 for 
similar capabilities.

Startup time is definitely something to be aware of, but most people have needs 
beyond outputting a line of text to STDOUT.

Pm


Re: grammars and indentation of input

2016-09-13 Thread Patrick R. Michaud
I don't have an example handy, but I can categorically say that
Perl 6 grammars are designed to support exactly this form of parsing.
It's almost exactly what I did in "pynie" -- a Python implementation
on top of Perl 6.  The parsing was done using a Perl 6 grammar.

If I remember correctly, Pynie had , , and 
grammar rules.  The grammar kept a stack of known indentation levels.
The  rule was a zero-width match that would succeed when it
found leading whitespace greater than the current indentation level
(and push the new level onto the stack).  The  rule
was a zero-width match that succeed when the leading whitespace
exactly matched the current indentation level.  And the 
rule would be called when  and  no longer 
matched, popping the top level off the stack.

So the grammar rule to match an indented block ended up looking
something like (I've shortened the example here):

token suite {
 
[   ]*
[  |  ]
}

A python "if statement" then looked like:

rule if_stmt {
'if'  ':' 
[ 'elif'  ':'  ]*
[ 'else' ':'  ]?
}

where the  subrules would match the statements or block
of statements indented within the "if" statement.

However, all of , , and  were written using
"normal" (non-regular expression) code.  Perl 6 makes this easy; since 
grammar rules are just methods in a class (that have a different code
syntax), you can create your own methods to emulate a grammar rule.  
The methods simply need to follow the Cursor protocol; that is, 
return Match objects indicating success/failure/length of whatever has 
been parsed at that point.

I hope this is a little useful.  If I can dig up or recreate a more 
complete Python implementation example sometime, I'll post it.

Pm


On Tue, Sep 13, 2016 at 01:13:45PM +0200, Theo van den Heuvel wrote:
> Hi all,
> 
> I am beginning to appreciate the power of grammars and the Match class. This
> is truly a major asset within Perl6.
> 
> I have a question on an edge case. I was hoping to use a grammar for an
> input that has meaningful indented blocks.
> I was trying something like this:
> 
>   token element { <.lm> [  | $=[ ' '+ ] )> ] }
>   token lm { ^^ ' '**{$cur-indent} } # skip up to current indent level
> 
> My grammar has a method called within the level rule that maintains a stack
> of indentations and sets a $cur-indent.
> I can imagine that the inner workings of the parser (i.e. optimization)
> frustrate this approach.
> Is there a way to make something like this work?
> 
> Thanks,
> Theo
> 
> -- 
> Theo van den Heuvel
> Van den Heuvel HLT Consultancy


Re: Fwd: Re: grammars and indentation of input

2016-09-13 Thread Patrick R. Michaud
On Tue, Sep 13, 2016 at 10:35:01AM -0400, Bennett Todd wrote:
> Having the minutia of the programmatic run-time state of the parse then 
> influence the parse itself, is at the heart of the perl5 phenomenon "only 
> Perl can parse perl", which I rather hope isn't going to be preserved in 
> perl6.

You may be disappointed to read this:  Not only is this feature preserved in 
Perl 6... it's something of a prerequisite.  It is what is required for a truly 
dynamic language that has many things happening in BEGIN blocks (i.e., things 
get executed even before you finish compiling the thing you're working on) and 
that allows dynamically adding new statement types and language features to the 
grammar.

When implementing Perl 6, I think many of us aimed to minimize the amount of 
"runtime" things that happened during the parse... only to discover that we 
actually had to embrace and formalize it instead.

Pm


Re: can Perl 6 bootstrap itself

2016-08-25 Thread Patrick R. Michaud
On Thu, Aug 25, 2016 at 10:37:45AM -0700, Dipesh Sharma wrote:
> Dependency on perl5 for building perl6 looks like a concern. It means that
> we can't have and environment with perl6, without perl5. 

I disagree.  Just because perl5 is currently required to *build* Rakudo 
doesn't mean that perl5 has to be installed in order to *use* Rakudo.

For example:

"Dependency on gcc for building bash looks like a concern.  It means
that we can't have an environment with bash, without gcc."  

However, I know of a lot of systems that use bash that don't have
gcc installed, so the above statement is clearly false..  Note 
that you can replace "bash" in the statement above with things 
like "awk", "sed", or even "perl5" and it's equally as false.

As a very real example of this:  It's entirely possible TODAY for
Windows users to install and use Rakudo without having Perl 5
installed on their system.

Pm


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  instead:

$ cat xyz.p6
my $match;

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

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

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

$ ./perl6 xyz.p6
core is abc

Hope this helps,

Pm

On Mon, Feb 22, 2016 at 10:25:19AM +0100, Theo van den Heuvel wrote:
> 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
> 


Re: is there a Perl 5 converter?

2016-01-21 Thread Patrick R. Michaud
On Thu, Jan 21, 2016 at 01:39:15PM -0600, Aaron Baugher wrote:
> Tom Browder  writes:
> 
> > Thanks, Aaron, good explanation.  But can you find a description of
> > '<->' in the Perl 6 docs?
> 
> It's mentioned here: https://doc.perl6.org/language/control#for
> 
> And here, where it's called the "double-ended arrow", though I don't know how
> official that name is: https://design.perl6.org/S04.html#The_for_statement
> 
> I don't know if it's actually an operator, which may be why it's hard to find.

'<->' isn't an operator, it's one of the tokens that introduces a pointy block 
term.  It's the "default to rw" form of '->' for declaring a block with 
parameters.

Pm


Re: Recalling previous commands

2016-01-01 Thread Patrick R. Michaud
While I recall that we've often discussed building command history into 
Rakudo's REPL directly, the workaround suggested to me was to use 'rlwrap':


   $ rlwrap ./perl6

Then the arrow keys work, as well as CTRL-P and other bash-like history 
commands.  I've never used CTRL-K for history, but rlwrap is customizable so 
there's probably a way to get that to work somehow.

Pm

On Fri, Jan 01, 2016 at 04:47:15PM -0500, Parrot Raiser wrote:
> Is there any way to recall a previous command (for correction or
> re-running), when using Perl 6 in the interactive REPL mode?
> 
> Every time I make a typo in a complex command, I reflexively hit
> ctrl-k before remembering I'm not in bash any more.  :-)*


Re: c99 hexadecimal floating point support?

2015-12-31 Thread Patrick R. Michaud
On Thu, Dec 31, 2015 at 04:13:40PM +0900, Dan Kogai wrote:
> Anyway, is there a plan to support hexadecimal floating point support?
> % perl6 -e 'say 0x1.921fb54442d18p+1'
> ===SORRY!=== Error while compiling -e
> Malformed postfix call
> at -e:1
> --> say 0x1.⏏921fb54442d18p+1

$ ./perl6 -e 'say :16<1.921fb54442d18*2**1>'
3.1415926535897931

$ ./perl6 -e 'say :16<3.243F6A8885A3>'
3.1415926535897931

> FYI Perl5 has started supporting since 5.22.

Fractional values of any radix have been in the Perl 6 design for years, and I 
suspect Rakudo has implemented it for at least 2-3 years, if not longer.

Note that the values listed above are not "floating point" (Num) -- they're 
Rats.  If you're looking specifically for the c99 hex float notation itself... 
no, Perl 6 doesn't have that AFAIK.

Pm


Re: release?

2015-12-29 Thread Patrick R. Michaud
On Tue, Dec 29, 2015 at 01:57:57AM -0800, Darren Duncan wrote:
> On that note, are there going to be Perl 6 versions 6.x.y where {x,y} are
> integers?  Will 6.0.0 be the first such one? -- Darren Duncan

This was the topic of my FOSDEM talk last year, and then again at YAPC::NA.

"Perl 6" is a language, not an implementation of that language.  Think of "Perl 
6" as being like "C", "C++", "Javascript", etc., where the language is separate 
from the (many) implementations of that language.

There are two key points to make:

1.  Language specification should follow implementations, not precede them.  
This has been found to be true for many programming languages, and it's the way 
things work in the Internet RFC/STD process.  An update to a language spec 
recognizes and ratifies the features that have been largely agreed upon by 
implementations and users, as opposed to prescribing what the next version of 
the language ought to look like.  First is rough consensus, then running code, 
and *then* formalization into a specification.

So, if language specification follows implementation, it's not possible for 
Rakudo or other implementations to use language version numbers as their 
primary versioning scheme.  To take an example from the C language:  My gcc 
compiler says it's version 5.2.1, but there's not a version "5.2.1" of the C 
Programming Language.  Similarly, one doesn't speak of the "C89", "C99", or 
"C11" release of GCC.

2.  It doesn't make a lot of sense to think of major/minor version numbers such 
as 6.x.y when discussing a language specification.  Compiler releases happen 
often, incorporating new features, bug fixes, and small incremental changes.  
Language specification changes tend to happen on longer timescales -- there's 
not really a notion of a "minor release" on such timescales.  So, the language 
specifications are being versioned as "6.a", "6.b", "6.c", etc., instead of a 
scheme incorporating minor version increments.

Yes, this separation of language specification and implementation can be 
unnerving to those that are so used to Perl 5's tight coupling of the two, 
including using a common "version number" for both.  But that tight coupling is 
partly what led to several of Perl 5's evolutionary dead ends and roadblocks, 
and we're trying to avoid repeating that mistake with Perl 6.

Hope this helps.

Pm


On Tue, Dec 29, 2015 at 01:57:57AM -0800, Darren Duncan wrote:
> On that note, are there going to be Perl 6 versions 6.x.y where {x,y} are
> integers?  Will 6.0.0 be the first such one? -- Darren Duncan
> 
> On 2015-12-29 12:51 AM, Tobias Leich wrote:
> >Hi, the first official Perl 6 (the language) release is not called 6.0.0, it 
> >is
> >called 6.c.
> >And this is what has been shipped with the Rakudo compiler release 2015.12.
> >
> >Cheers, Tobias
> >
> >Am 27.12.2015 um 20:33 schrieb webmind:
> >>Hiya,
> >>
> >>I'm a bit confused, there is a major release for Perl 6, but I know
> >>wonder if this is the 6.0.0 release or when this will be?
> >>
> >>Thanks
> >>
> >>web
> >>
> >
> >
> 


Re: Missing documentation

2015-10-28 Thread Patrick R. Michaud
I suspect that http://doc.perl6.org/language/5to6 should at 
least have be a redirect to somewhere useful, if not an index
of the available 5to6 pages.

Pm

On Wed, Oct 28, 2015 at 09:22:55PM +0100, Kaare Rasmussen wrote:
> On 10/28/2015 08:31 PM, Parrot Raiser wrote:
> >This Perl 5 to 6 Translation guide http://doc.perl6.org/language/5to6
> >is mentioned in several places, but returns a 404.  Is it obsolete, or
> >just misplaced?
> This one you're looking for?
> http://doc.perl6.org/language/5to6-nutshell.html


Re: How to call a super class method?

2015-10-28 Thread Patrick R. Michaud
On Wed, Oct 28, 2015 at 03:31:09AM +, TS xx wrote:
> 
> Can I call the Person's constructor (in non static context), 
> pass the required parameter and do more things before returning?

There are two answers to this question, both of which likely deserve
a few lines in doc.perl6.org/language/faq.  Lloyd alludes to both
answers in his replies to the original post.

1.  The typical answer to this question is to use "callwith",
"callsame", "nextwith", or "nextsame".

2.  Constructors already have some special support for building 
the superclass portions of an object -- see the BUILD submethod
described in Synopsis 12.

Pm


Re: Sub args: choose one of two?

2015-07-02 Thread Patrick R. Michaud
On Thu, Jul 02, 2015 at 03:21:11PM -0500, Tom Browder wrote:
> Okay, a second look shows me that's not quite as bad as I first though.


Another possibility is to let MAIN unpack the args for you, but then check 
the exclusivity directly instead of using multisubs to do it:

   sub MAIN(:$need, :$hope) {
   unless $need.defined xor $hope.defined {
   say "Usage: Exactly one of --need or --hope required";
   exit 1;
   }
   # rest of MAIN goes here
   }


Or use a one() junction, which reads quite nicely:

   sub MAIN(:$need, :$hope) {
   unless one( $need.defined, $hope.defined ) {
   say "Usage: Exactly one of --need or --hope required";
   exit 1;
   }
   # rest of MAIN goes here
   }


Pm


Re: Sub args: choose one of two?

2015-07-02 Thread Patrick R. Michaud
On Thu, Jul 02, 2015 at 03:22:17PM -0400, Brandon Allbery wrote:
> On Thu, Jul 2, 2015 at 3:08 PM, Tom Browder  wrote:
> 
> > 1.  Write the 'main' program as another subroutine and call it from
> > each of the appropriate multi
> > subs--aarghh!
> >
> 
> This seems like the right one to me; it also makes it easier to provide
> similar functionality as a library.

This is the approach I would take, yes.

Pm


Re: Sub args: choose one of two?

2015-06-30 Thread Patrick R. Michaud
On Sat, Jun 27, 2015 at 05:39:32PM -0500, Tom Browder wrote:
> I'm trying to take advantage of the MAIN suroutine to handle most all of my
> routine command line arg handling.  One idiom I use a lot is for the user
> to choose only one of two args, but one must be chosen.

Perhaps you want that the named arguments are required rather than
optional, via the exclamation point.  Thus:


multi sub MAIN(:$need!) { say "need"; }

multi sub MAIN(:$hope!) { say "hope"; }


If passed with either option, it executes the corresponding multi candidate.
If neither or both options are passed, it produces a usage message:


pmichaud@kiwi:~/p6/rakudo$ ./perl6 x.p6
Usage:
  x.p6 --need= 
  x.p6 --hope= 


Pm


Re: generating grammars, capturing in regex interpolation, etc.

2015-04-14 Thread Patrick R. Michaud
On Tue, Apr 14, 2015 at 08:58:27PM -0400, Nathan Gray wrote:
> I've run into a snag, in that my strptime processing in Perl 5
> relies on building a string that looks like a regex with named
> captures, and then interpolating that into a real regex.
>[...]
> my $pattern = Q/$=[hello]/;
> my $string = Q/hello/;
>[...]

Just an idea: instead of building strings to be interpolated into 
a regex, could you just build regexes directly?

my $pattern = rx/$=[hello]/;
my $match = "hello" ~~ /  /;

The resulting string is captured into $match;
The second statement can also be written as:

# captures into $match
my $match = "hello" ~~ / $=$pattern /;
   
# captures into $match[0]
my $match = "hello" ~~ / $<0>=$pattern /;   
 
Hope this is useful, or at least illustrative.

> Of course, there may be a better way, since regex interpolation
> seems frowned upon in Perl 6.

I think it's more that we treat regexes as first class components (actually
closures)...  rather than EVALing strings with metacharacters, we just 
build regex expressions and interpolate them directly.

Pm


Re: Profiling Perl 6 code

2014-12-31 Thread Patrick R. Michaud
If you're running Rakudo on MoarVM, try the --profile option.  It will create 
an HTML file that shows a lot of useful information, including time spent in 
each routine, call graphs, GC allocations, etc.

Pm

On Wed, Dec 31, 2014 at 09:35:33AM +0200, Gabor Szabo wrote:
> The Perl 6 Maven site is a static site generated by some Perl 6 code.
> Currently it takes about 8 minutes to regenerate the 270 pages of the site
> which is quite frustrating.
> 
> Is there already a tool I could use to profile my code to see which part
> takes the longest time
> so I can focus my optimization efforts in the most problematic area?
> 
> regards
>Gabor


Re: Is this a strange regex bug in my code?

2014-12-29 Thread Patrick R. Michaud
I suspect it may be some weirdness with the way that $_ is being handled in 
smartmatching, then.

I think there's a slight difference between

$tmpl ~~ /regex/

and

$tmpl ~~ m/regex/

The first one does the equivalent of /regex/.ACCEPTS($tmpl), which ends up 
matching $tmpl directly against the regex and returning the resulting Match 
object.

The second one temporarily assigns $tmpl into $_, then m/regex/ does an 
immediate match against underscore to produce a Match object, which then has 
.ACCEPTS($tmpl) called on it (which returns the Match object).

I don't know exactly what is happening when !~~ is used with m/.../ -- i.e., 
when $_ is being assigned, what is happening to the Match object, and where 
negation is taking place.  It would be interesting to know if the following 
fails for you also:

   if not $tmpl ~~ m/\.txt$/ { ... }

Pm


On Tue, Dec 30, 2014 at 09:29:39AM +0200, Gabor Szabo wrote:
> No. If I remove the leading m from the regex, then the bug is gone.
> Gabor
> 
> On Tue, Dec 30, 2014 at 9:19 AM, Patrick R. Michaud 
> wrote:
> 
> > Out of curiosity, is the bug still present if you use /\.txt$/ instead of
> > m/\.txt$/ ?
> >
> > At the moment it looks like a Rakudo bug to me, but I haven't been able to
> > golf it further to be certain.
> >
> > Pm
> >
> > On Tue, Dec 30, 2014 at 09:11:52AM +0200, Gabor Szabo wrote:
> > > Just to follow-up:
> > > The problem appears in
> > >
> > https://github.com/szabgab/Perl6-Maven/commit/4346c96d63e97def55e789bbeebdbdaebe8b0b33
> > >
> > > After that I have replaced the regex match with
> > >
> > > if substr($tmpl, *-4) ne '.txt' {
> > >
> > > that works correctly, but I'd still like to understand if the bug was in
> > my
> > > code, or if this is some Rakudo issue?
> > >
> > > Gabor
> > >
> > >
> >


Re: Is this a strange regex bug in my code?

2014-12-29 Thread Patrick R. Michaud
Out of curiosity, is the bug still present if you use /\.txt$/ instead of 
m/\.txt$/ ?  

At the moment it looks like a Rakudo bug to me, but I haven't been able to golf 
it further to be certain.

Pm

On Tue, Dec 30, 2014 at 09:11:52AM +0200, Gabor Szabo wrote:
> Just to follow-up:
> The problem appears in
> https://github.com/szabgab/Perl6-Maven/commit/4346c96d63e97def55e789bbeebdbdaebe8b0b33
> 
> After that I have replaced the regex match with
> 
> if substr($tmpl, *-4) ne '.txt' {
> 
> that works correctly, but I'd still like to understand if the bug was in my
> code, or if this is some Rakudo issue?
> 
> Gabor
> 
> 
> On Tue, Dec 30, 2014 at 8:57 AM, Gabor Szabo  wrote:
> 
> > I am puzzled by this.
> >
> > I have code like this:
> >
> > my @files = dir("$.source_dir").map({ $_.basename });
> >
> > for @files -> $tmpl {
> >
> > if $tmpl !~~ m/\.txt$/ {
> >
> > debug("Skipping '$tmpl' it does not end with .txt");
> >
> > next;
> >
> > }
> >
> > debug("Source file $tmpl");
> >
> > }
> >
> > and sometimes(!) it skips when it encounters a file called   'perl6-zip.txt'
> > or a file called 'perl6-write-file.txt'
> >
> > More specifically when I ran the above code (part of
> > https://github.com/szabgab/Perl6-Maven )
> >
> > on https://github.com/szabgab/perl6maven.com on this commit:
> > https://github.com/szabgab/perl6maven.com/commit/672ca19f8cc0cf893568f93c4c1488c0cd777f7c
> >   everything worked fine, but when I ran the same code on the next commit (
> > https://github.com/szabgab/perl6maven.com/commit/75e188288638dea03a0b3329b249f3685859e701
> > ) then suddenly it started to skip those two files.
> >
> >
> >


Re: Moar Parrots

2014-09-09 Thread Patrick R. Michaud
On Tue, Sep 09, 2014 at 10:07:46PM +0200, Alex Becker wrote:
> Hitting the download button for Perl 6 leads to this page:
> http://rakudo.org/downloads/star/
> There is a set of undocumented files. For 2014.08, there is one msi file
> with the Suffix moar, and one with the Suffix parrot.

To avoid the "undocumented files" problem... if someone will create a README 
for that directory, I'll make sure it gets installed and configured into that 
directory's page.

> So, if I just want to have a look at Perl 6 and how it behaves on Windows,
> which one should I use?

I suspect either will work fine; I'd likely try the "-moar" one myself.

Pm


Re: match's replacement name?

2014-05-23 Thread Patrick R. Michaud
On Fri, May 23, 2014 at 03:08:38PM -0400, Peter Schwenn wrote:
> Still it would be more straightforward to have something like
>  $layn ~~ s:g/ (\W) [[RMA\.]? OpenNURBS\.]? I? On (<[2..4]>) dPoint
> /$0Rhino.Geometry.Point$1d/;
> and have a more perl6-built-in way of getting hold of the /replacement/ and
> the count.

If it's :g, then wouldn't it be "replacement*s*"?

The real question to me is whether this is a common enough use case to
warrant the overhead of saving the replacement string(s) for every
s// , or if doing it via closure is sufficient (if a little ugly, but
IMO it's okay for rare to be a little ugly if it means common remains
fast(er) :).

Pm


Re: Stickers of Parrot and Perl 6 for GSoC

2013-10-07 Thread Patrick R. Michaud
   https://github.com/perl6/mu/blob/master/misc/camelia.svg
   https://github.com/perl6/mu/blob/master/misc/camelia.odg

I have a .ai of the Parrot head logo if you need it and can
send it to you.

Pm


On Mon, Oct 07, 2013 at 06:32:57PM -0500, Bruce Gray wrote:
> At the upcoming GSoC Mentor Summit, they will have a sticker exchange table.
> I would like to take Parrot and Perl 6 stickers for the exchange.
> 
> 1.Does anyone already have a supply of stickers, or already have a proof 
> on file with a print shop?
> 
> 2.Who has the original artwork for the Parrot and Camelia logos?
>   I would like to generate higher resolution images from the vector 
> originals for the print shop.
>   
> http://www.parrot.org/sites/www.parrot.org/files/parrotify_logo.png
>   http://perl6.org/camelia-logo.png
>   ( 
> https://raw.github.com/perl6/mu/master/misc/camelia.txt )
> 
> 3."Parrot speaks your language" is the obvious slogan to use for Parrot; 
> it is already in the logo.
>   Any recommendations on a slogan for the Perl 6 stickers? Just the text 
> "Perl 6" is my default.
> 
> -- 
> Thank you,
> Bruce Gray (Util of PerlMonks)
> 


Re: as perl6 has no $/ ...

2013-09-23 Thread Patrick R. Michaud
On Tue, Sep 24, 2013 at 02:14:50AM +0200, Marc Chantreux wrote:
> Come on, Perl6 people! did i miss something that takes carre of separators? 
> it would be nice to have something like:

I think it's currently specced in S32 as :nl("\n").  
See http://perlcabal.org/syn/S32/IO.html#open and
http://perlcabal.org/syn/S32/IO.html#input-line-separator .  
It may be NYI in Rakudo Perl 6 as yet.

Pm


Re: Rakudo Star 2013.05 released

2013-05-30 Thread Patrick R. Michaud
On Thu, May 30, 2013 at 11:08:13PM -0500, Patrick R. Michaud wrote:
> This Star release includes [release 2013.05] of the
> [Rakudo Perl 6 compiler], version 5.2.0 of the [Parrot Virtual
> Machine] ...

Oops.  The 2013.05 release actually contains Parrot 5.3.0.

Sorry about the typo.

Pm


Rakudo Star 2013.05 released

2013-05-30 Thread Patrick R. Michaud
## A useful, usable, "early adopter" distribution of Perl 6

On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the May 2013 release of "Rakudo Star", a useful and usable
distribution of Perl 6. The tarball and Windows .MSI for the May 2013 
release are available from . 

In the Perl 6 world, we make a distinction between the language
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  This Star release includes [release 2013.05] of the
[Rakudo Perl 6 compiler], version 5.2.0 of the [Parrot Virtual
Machine], plus various modules, documentation, and other resources
collected from the Perl 6 community.

[release 2013.05]:
https://github.com/rakudo/rakudo/blob/nom/docs/announce/2013.05.md
[Rakudo Perl 6 compiler]: http://github.com/rakudo/rakudo
[Parrot Virtual Machine]: http://parrot.org

Some of the new features added to this release include:

* The ?-quantifier on regex captures now returns a single Match object 
  (formerly returned an array).  Use `** 0..1` to get the old behavior.
* Failed matches return Nil instead of a false Match object.
* Rakudo warns when pure expressions are used in sink context
* .substr(...) now correctly accepts whatever-star closures
* Implemented shellwords postcircumfix (%h<< $x 'foo bar' >>)
* Defining operators spelled like the empty string is now illegal
* Array interpolations now properly do LTM
* Autothread "none" and "all" junctions before "any" and "one"
* Helpful error if you write "else if"/"elif" instead of "elsif"
* Throw exception if a Range is used as a Range endpoint
* Corrected argument order in IO.seek
* wrap low level VM objects in ForeignCode, allowing perl6 OO calls on them
* for loops are eager again
* add link and symlink to IO
* add Capture.Bool()
* improvements to DUMP()
* various optimizations in the optimizer and the runtime
* smartmatch against list now supports Whatever wildcards
* IO::Spec, a port of Perl 5's File::Spec
* regex special characters can be used as delimiters
* allow slice with :exists adverb on hashes
* added 125 extra opening/closing bracket-pairs

This release also contains a range of bug fixes, improvements to error
reporting and better failure modes.

The following features have been deprecated or modified from previous
releases due to changes in the Perl 6 specification, and are planned
to be removed or changed as follows:

  * `postcircumfix:<[ ]>` and `postcircumfix:<{ }>` will become
multi-subs rather than multi-methods. Both at_pos and at_key will
remain methods.

  * Unary hyper ops currently descend into nested arrays and hashes.
This will change to make them equivalent to a one-level map.

  * The Str.ucfirst builtin is deprecated; it will be replaced by
Str.tc.

  * Leading whitespace in rules and under :sigspace will no longer be
converted to `<.ws>`.  For existing regexes that expect this
conversion, add a `` in front of leading whitespace to make it
meta again.

  * The result of failed matches will be Nil instead of a Match
object returning boolean False.

There are some key features of Perl 6 that Rakudo Star does not yet
handle appropriately, although they will appear in upcoming releases.
Some of the not-quite-there features include:

  * advanced macros
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * interactive readline that understands Unicode
  * non-blocking I/O
  * much of Synopsis 9

There is an online resource at 
that lists the known implemented and missing features of Rakudo and
other Perl 6 implementations.

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are many
that we've missed.  Bug reports about missing and broken features are
welcomed at .

See  for links to much more information about
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.  A
draft of a Perl 6 book is available as docs/UsingPerl6-draft.pdf in
the release tarball.

The development team thanks all of the contributors and sponsors for
making Rakudo Star possible.  If you would like to contribute, see
, ask on the 
mailing list, or join us on IRC \#perl6 on freenode.



Re: prove that the meaning of live is math

2013-05-26 Thread Patrick R. Michaud
On Sun, May 26, 2013 at 09:54:21AM -0500, Hao Wu wrote:
> However, why 42? any relation to meaning of life? It seems I miss
> something. Thanks.

42 is the "Answer to the Ultimate Question of Life, the Universe, 
and Everything", which is sometimes shortened to be "meaning of life".

See 
https://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker%27s_Guide_to_the_Galaxy
 .

Pm


Re: Packaging Perl 6 (or rather, Rakudo Star)

2013-03-05 Thread Patrick R. Michaud
On Tue, Mar 05, 2013 at 12:02:01PM +0100, Rob Hoelz wrote:
> On 3/5/13 11:44 AM, Patrick R. Michaud wrote:
> > It may also be worth noting/reminding that Rakudo Star has never been
> > intended to be the "only" or even "primary" module collection, it's just
> > one of the first.  It could make good sense to come up with a new
> > P6 distribution that is better tailored to the needs of OS distros.
> 
> Another good point; should we hold off on making packages for Rakudo
> Star until something more appropriate comes along, or should we go
> ahead and make some packages?  I would favor the latter, myself.

Same here.  I think "something more appropriate" is much more likely to
arrive with the "go ahead and make" approach than the "hold off" one.  :)

Pm


Re: Packaging Perl 6 (or rather, Rakudo Star)

2013-03-05 Thread Patrick R. Michaud
On Tue, Mar 05, 2013 at 11:13:51AM +0100, Rob Hoelz wrote:
> I already have my own package for Arch Linux for Rakudo Star, and I keep
> the OS X homebrew package up-to-date as well.  I'd like to create an RPM
> spec file and a DEB spec file as well.  I have two questions:
> 
> 1) Do these spec files belong in the Rakudo Star repository?

I have no problem with maintaining spec files in any of the
Rakudo-related repos (NQP, Rakudo, Star).

> 2) Which makes more sense: having a Rakudo Star package that depends on
> a separate Rakudo package (so Rakudo Star would only consist of modules
> and applications), or having a Rakudo Star package that conflicts with a
> separate Rakudo package (so users may install one or the other)?  [...]

I suspect to ever be considered for official inclusion in Debian/Ubuntu
distros, you'd have to have the first option (separate compiler and
module packages).  And moreso:  they likely prefer to see each module
as its own package, rather than a single package containing a complete
collection of modules.  (I think module collections in the .deb world 
tend to be managed as packages with dependencies, as opposed to 
all-in-one packages.)

It may also be worth noting/reminding that Rakudo Star has never been
intended to be the "only" or even "primary" module collection, it's just
one of the first.  It could make good sense to come up with a new
P6 distribution that is better tailored to the needs of OS distros.

Pm


Re: implementing every(N)

2013-01-08 Thread Patrick R. Michaud
On Tue, Jan 08, 2013 at 12:14:22PM -0500, Ted Zlatanov wrote:
> On Mon, 7 Jan 2013 17:51:52 +0100 Carl Mäsak  wrote: 
> 
> CM> Ted (>):
> >> Are state variables available now, or is the every(N) functionality
> >> possible in some other way now?
> 
> CM> Why not try it by writing a small program? :)
> CM> $ perl6 -e 'sub foo { state $s = 0; say $s++ }; foo; foo; foo'
>
> Since I'm writing a module, I didn't think a one-liner was sufficient
> proof that state variables are reliable.  Sorry I didn't make that
> clear.  [...]

Also, if the state variables currently behave as you expect, and we
want to insure their reliability for the future, add a spectest to 
the "roast" suite.  This way we'll also quickly discover if other 
Perl 6 implementations differ on this point.  :-) 

Thanks!

Pm


Rakudo Star 2012.09 released

2012-09-30 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the September 2012 release of "Rakudo Star", a useful and
usable distribution of Perl 6.  The tarball for the September 2012
release is available from .
A Windows .MSI version of Rakudo star will usually appear in
the downloads area shortly after the tarball release.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  This Star release includes release 2012.09.1 [0] of the
Rakudo Perl 6 compiler [1], version 4.6.0 of the Parrot Virtual
Machine [2], and various modules, documentation, and other
resources collected from the Perl 6 community.

Some of the new features added to this release include:

* Basic macro support!

* Support for Perl 5 (m:P5/.../) regex syntax!

* Indirect type names in routine and type declarations are supported.

* We support the "is export" trait on constant declarations.

* The "is hidden" and base traits are supported.

* Str.wordcase, is-prime, and expmod are implemented.

* Compilation is slightly faster than before.

* Tie-breaking with constraints selects the first matching
  constraint rather than demanding mutual exclusion.

* Smart matching against Signature literals, and binding to Signatures
  in declarators.

This release also contains a range of bug fixes, improvements to error
reporting and better failure modes. More exceptions are thrown as typed
exceptions, and more meta-model errors have been fixed to properly
report line numbers.

The following features have been deprecated or modified from previous
releases due to changes in the Perl 6 specification, and are being removed
or changed as follows:

* Iterable is now a role instead of a class, and no longer inherits 
  from Cool.

* Parameters preceded by a | or \ can no longer have a sigil.

* IO::Path.dir (which returns the directory part of the path) has been
  renamed to IO::Path.directory.  IO::Path.dir will be removed or
  re-purposed.

* The Str.ucfirst builtin is deprecated; it will be replaced by Str.tc.

* The (experimental) LAZY statement prefix will soon be removed.

* Leading whitespace in rules and under :sigspace will no longer be
  converted to <.ws> .  For existing regexes that expect this conversion,
  add a  in front of leading whitespace to make it meta again.

* The ?-quantifier on captures in regexes currently binds the capture
  slot to a List containing either zero or one Match objects; i.e., it
  is equivalent to "** 0..1".  In the future, the ?-quantifier will
  bind the slot directly to a captured Match or to Nil.  Existing code
  can manage the transition by changing existing ?-quantifiers to
  use "** 0..1", which will continue to return a List of matches.

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Some of the not-quite-there features include:

  * advanced macros
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * interactive readline that understands Unicode
  * non-blocking I/O
  * much of Synopsis 9

There is an online resource at http://perl6.org/compilers/features 
that lists the known implemented and missing features of Rakudo 
and other Perl 6 implementations.

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed at .

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
A draft of a Perl 6 book is available as  
in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

[0] https://github.com/rakudo/rakudo/blob/nom/docs/announce/2012.09
[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/


Rakudo Star 2012.08 released

2012-08-31 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the August 2012 release of "Rakudo Star", a useful and
usable distribution of Perl 6.  The tarball for the August 2012
release is available from .
A Windows .MSI version of Rakudo Star is also being made available
in the downloads area.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  This Star release includes release 2012.08 [0] of the
Rakudo Perl 6 compiler [1], version 4.6 of the Parrot Virtual
Machine [2], and various modules, documentation, and other
resources collected from the Perl 6 community.

Some of the new features added to this release include:

* Rakudo Star now includes a Perl 6 debugger!  The debugger allows
  single-stepping, setting breakpoints, variable inspection/modification, 
  regex debugging, and more!  Enter "perl6-debug " to run 
  a script in debugging mode.  Enter "help" from a debug prompt to
  see the available commands.

* Memory usage of the build stage has been reduced by 35% - 40%.  This
  makes it possible to build and compile Rakudo Star on machines with
  less memory (although 1.2GB may still be needed for some 64-bit
  environments).

* Variables prefixed by | or \ in signatures are now sigilless, per updates
  to the Perl 6 specification.

* Circularities in module loading are now detected.

* An improved inliner, allowing a wider range of routines to be inlined.

* Str.bytes and lcfirst have been removed.  The tclc builtin
  has been added.

* 'abs' is now a normal subroutine instead of a prefix operator.

* IO::File and IO::Dir have been removed.

* The integer argument to IO::Socket.recv is now interpreted as 
  a number of characters/codepoints.

This release also contains a range of bug fixes, improvements to error
reporting and better failure modes. More exceptions are thrown as typed
exceptions, and more meta-model errors have been fixed to properly
report line numbers.

The following features have been deprecated or modified from previous
releases due to changes in the Perl 6 specification, and are being removed
or changed as follows:

* Parameters preceded by a | or \ can no longer have a sigil.

* IO::Path.dir (which returns the directory part of the path) has been
  renamed to IO::Path.directory.  IO::Path.dir will be removed or
  re-purposed.

* The Str.ucfirst builtin is deprecated; it will be replaced by Str.tc.

* The (experimental) LAZY statement prefix will soon be removed.

* Leading whitespace in rules and under :sigspace will no longer be
  converted to <.ws> .  For existing regexes that expect this conversion,
  add a  in front of leading whitespace to make it meta again.

* The ?-quantifier on captures in regexes currently binds the capture
  slot to a List containing either zero or one Match objects; i.e., it
  is equivalent to "** 0..1".  In the future, the ?-quantifier will
  bind the slot directly to a captured Match or to Nil.  Existing code
  can manage the transition by changing existing ?-quantifiers to
  use "** 0..1", which will continue to return a List of matches.

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Some of the not-quite-there features include:

  * macros
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * interactive readline that understands Unicode
  * non-blocking I/O
  * much of Synopsis 9

There is an online resource at http://perl6.org/compilers/features 
that lists the known implemented and missing features of Rakudo Star
2012.08 and other Perl 6 implementations.

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed at .

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
A draft of a Perl 6 book is available as  
in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

[0] https://github.com/rakudo/rakudo/blob/nom/docs/announce/2012.08
[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/


Rakudo Star 2012.07 released

2012-07-28 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the July 2012 release of "Rakudo Star", a useful and
usable distribution of Perl 6.  The tarball for the July 2012
release is available from .

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  This Star release includes release 2012.07 [0] of the
Rakudo Perl 6 compiler [1], version 4.6 of the Parrot Virtual
Machine [2], and various modules, documentation, and other
resources collected from the Perl 6 community.

Some of the new features added to this release include:

* Built-in metaobjects (e.g. Metamodel::ClassHOW) now inherit from Any

* &open now supports the :enc/:encoding option

* anonymous subset types (e.g., 'subset :: of Int where { $_ > 0 }')

* Rakudo Star now ships with the Template::Mojo module

This release also contains a range of bug fixes, improvements to error
reporting and better failure modes. More exceptions are thrown as typed
exceptions, and more meta-model errors have been fixed to properly
report line numbers.

Starting with this release, we will also identify changes to the
implementation or specification that can cause breakages in existing
Perl 6 code.  The following features have been deprecated or modified
due to changes in the Perl 6 specification, and are being removed
or changed as follows:

* IO::File and IO::Dir will go away, and &dir now returns values of type
  IO::Path (which is currently the superclass of IO::File and IO::Dir).
  The return values of &dir will still stringify to the base name of the
  returned file and directory names, and you can call .path on them to
  obtain the full path.

* Leading whitespace in rules and under :sigspace will no longer be
  converted to <.ws> .  For existing regexes that expect this conversion,
  add a  in front of leading whitespace to make it meta again.
  Scheduled for the 2012.08 release.

* The ?-quantifier on captures in regexes currently binds the capture
  slot to a List containing either zero or one Match objects; i.e., it
  is equivalent to "** 0..1".  In the future, the ?-quantifier will
  bind the slot directly to a captured Match or to Nil.  Existing code
  can manage the transition by changing existing ?-quantifiers to
  use "** 0..1", which will continue to return a List of matches.
  Scheduled for the 2012.08 release, but may end up in 2012.09 .

* The method Str.bytes will be removed. To get the number of codepoints
  in a string, use .codes instead. To get the number of bytes in a
  given encoding, use $str.encode($encoding).bytes .
  Scheduled for the 2012.08 release.

* The method Str.lcfirst will be removed without replacement.
  Scheduled for the 2012.08 release.

* The method Str.ucfirst will eventually be removed, and replaced by
  Str.tc.
  No schedule yet, depends on having tc implemented first.

* 'abs' is currently a prefix operator, and will be changed to a normal
  subroutine.
  Scheduled for the 2012.08 release.

* The integer argument to IO::Socket.recv will be interpreted as number of
  characters/codepoints.
  Scheduled for the 2012.08 release.

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Some of the not-quite-there features include:

  * macros
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * interactive readline that understands Unicode
  * non-blocking I/O
  * much of Synopsis 9

There is a new online resource at http://perl6.org/compilers/features 
that lists the known implemented and missing features of Rakudo Star
2012.07 and other Perl 6 implementations.

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed at .

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
An updated draft of a Perl 6 book is available as 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

[0] https://github.com/rakudo/rakudo/blob/nom/docs/announce/2012.07
[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/


Re: File content is not written if close not called

2012-07-12 Thread Patrick R. Michaud
On Thu, Jul 12, 2012 at 05:36:58PM +0300, Gabor Szabo wrote:
> The following script leaves and epty 'data.txt' behind.
> Only if I call $fh.close is the file contents saved.
> 
> Is this a feature?
> 
> use v6;
> 
> my $fh = open 'data.txt', :w;
> $fh.print("hello\n");

While Rakudo and Parrot _should_ be closing the file upon
program exit, it's still a good idea to close filehandles
explicitly.  Since the GC doesn't have reference countfing, 
it's not always the case that filehandles are automatically
closed as soon as the last reference is broken, thus you
really want to close the filehandle explicitly.

It might be good for Rakudo and/or Parrot to have an option
to issue a warning whenever a open filehandle is closed due to
garbage collection, though.

Pm


Re: IO.s size how?

2012-07-05 Thread Patrick R. Michaud
On Thu, Jul 05, 2012 at 05:51:09PM +0300, Gabor Szabo wrote:
> I can write either
> $path.IO ~~ :e
> or
> $path.IO.e
> 
> to check if a $path exists. Is either of those recommended?
> 
> How can I check for size? Based on my understanding of src/core/IO.pm
> I'd think it is
> $path.IO.s
> but that only returns True/False for a file that exists/or not.
> Is this a bug or I don't understand it?

Actually, Rakudo was returning true if the file existed and if
its filesize was greater than zero.

Either way, it's a bug, now fixed in 58d9852.  IO.s now returns 
the size (in bytes) of the corresponding file.

Thanks!

Pm


Re: IO stat exception when using :l

2012-07-05 Thread Patrick R. Michaud
On Thu, Jul 05, 2012 at 05:34:43PM +0300, Gabor Szabo wrote:
> use v6;
> my $f = "a".IO;
> if $f ~~ :r {
>say 'file readable';
> }
> if $f ~~ :l {
>  say 'symlink';
> }
> 
> the readability and most other test fail and return some undef, but
> checking for :l (symlink) throws an exception if the thing does not exist
> 
> stat failed: No such file or directory
>   in method l at src/gen/CORE.setting:7042
>   in method ACCEPTS at src/gen/CORE.setting:5958
>   in block  at t.pl:7
> 
> Is that on purpose?

Looks like a bug to me; forwarding this message to rakudo...@perl.org 
to create a ticket for it.

Thanks!

Pm


Re: support for editing and history in the REPL?

2012-06-30 Thread Patrick R. Michaud
On Sat, Jun 30, 2012 at 07:21:10PM +0300, Gabor Szabo wrote:
> On Sat, Jun 30, 2012 at 7:16 PM, Patrick R. Michaud  
> wrote:
> > On Sat, Jun 30, 2012 at 06:39:55PM +0300, Gabor Szabo wrote:
> 
> Is there a list of recommended package to install before building Parrot?

The Rakudo Star distribution lists recommended packages in its README
(https://github.com/rakudo/star/blob/master/skel/README ).

I'll move this information over to the Rakudo compiler README as well.

Thanks,

Pm


Re: support for editing and history in the REPL?

2012-06-30 Thread Patrick R. Michaud
On Sat, Jun 30, 2012 at 06:39:55PM +0300, Gabor Szabo wrote:
> hi,
> 
> what do I need to install or enable in order to get a better REPL?
> 
> Things like history with up and down arrow and editing capabilities?

In Ubuntu (12.04), this requires the libreadline6-dev library to be 
installed at the time Parrot is built.  It's likely something similar
for other operating systems.

Pm


Re: say vs print for .WHAT

2012-06-28 Thread Patrick R. Michaud
Oops, typo:

On Thu, Jun 28, 2012 at 11:39:22AM -0500, Patrick R. Michaud wrote:
> To get say to act like "print with a newline", one can do
> 
> say [~] ar

That should be

say [~] arg1, arg2, arg3 ...

For the 'a'.WHAT case, this gives

> say [~] 'a'.WHAT
use of uninitialized value of type Str in string context

> 

Note that "True" (the result from say) isn't displayed here
because say sent a newline to the standard output.

Pm


Re: say vs print for .WHAT

2012-06-28 Thread Patrick R. Michaud
On Thu, Jun 28, 2012 at 09:41:48PM +0530, Siddhant Saraf wrote:
> (In Rakudo's REPL)
> 
> > say 'a'.WHAT;
> Str()
> > print 'a'.WHAT;
> use of uninitialized variable $v of type Str in string context
> True
> >
> 
> What is happening here? Is this a bug? 
> ( Coz I don't see any $v variable anywhere.)
> What is the "True" indicating?

The part about "$v" is a bug.  It should just be
   "use of uninitialized value of type Str in string context"

Rakudo is correct (with respect to the current spec) to complain 
about printing an undefined value here (all type objects
are undefined, including those returned by .WHAT).  
This is analogous to the Perl 5:

use warnings;
print undef;

which results in a "Use of uninitialized value in print" warning.

> What is the "True" indicating?

That's the return value from 'print' in the REPL.  Since the
command given to the REPL didn't produce any output (on $*OUT),
the REPL prints the return value of the print itself (True).

There might be an argument that if anything is displayed on
the standard error that the autoprinting of the result should
be suppressed; but I think I like things this way for now.
Either way, that part isn't a bug.

> May I also take this opportunity to ask someone to explain to 
> me what exactly are the differences between say and print?

print will stringify its arguments and write them to $*OUT.

say will invoke .gist on its arguments and write them (along
with a final newline) to $*OUT.  .gist is intended to provide
human-readable output somewhere between a straight 
Str value ("" in this case) and the the Perlish representation
given by .perl.

To get say to act like "print with a newline", one can do

say [~] ar


Pm


Re: install rakudo

2012-06-04 Thread Patrick R. Michaud
On Mon, Jun 04, 2012 at 02:38:05PM +0200, Marc Chantreux wrote:
> hello guys,
> 
> French Perl Workshop are comming and i hope a show around perl6. so i
> started to write a script that can be easy to pipe to a shell to install
> perl6.
> 
> https://gist.github.com/2868089 
> 
> i started it but it fail after nqp install:
> 
> https://gist.github.com/2868058
> 
> I have to admit i didn't investigate a lot but i really would like this
> script to work at Strasbourg (1 a month). Any idea ? 

Your script worked for me, after two modifications:
   1.  Add the --location option to the curl command, so that
   redirects from github are honored.
   2.  Remove the trailing slash from the $base variable.

The script I used ended up looking like:

set -e
dist=rakudo-star-2012.05
base=https://github.com/downloads/rakudo/star

curl --location $base/$dist.tar.gz |
gzip -cd |
tar x

cd $dist
perl Configure.pl --gen-parrot
make
make install

I'm guessing the error message you got in 
https://gist.github.com/2868058 comes from your Perl 5
installation looking in $PWD/lib for modules, and finding
Rakudo's lib.pm in lib/lib.pm in response to Configure.pl's
"use lib" statement.  Perl 5 then complains about not
understanding the (Perl 6) @*INC variable.  I'm not sure
if looking in $PWD/lib for Perl 5 modules is unique to
your environment or something we need to handle in a more
general case.

Hope this helps,

Pm


Re: Fwd: lc on arrays

2012-05-21 Thread Patrick R. Michaud
On Mon, May 21, 2012 at 10:08:34PM +0200, Carl Mäsak wrote:
> 
>    @a = @a.map: { lc $_ };
>    @a = @a.map: { .lc };
>    @a = @a.map: &lc;
>    @a = @a».lc;
>    @a».=lc;
>    @a = (.lc for @a);
> 
> Many ways to skin a cat -- [...]

Also:

@a .= map(*.lc);
@a .= map: *.lc

This somewhat keeps the mnemonic of " .= map(...) " performing
an "in-place" mapping on @a.

Pm


Re: Is rindex broken or does my brain need a reboot?

2012-05-08 Thread Patrick R. Michaud
On Tue, May 08, 2012 at 01:02:24AM -0700, Stefan O'Rear wrote:
> On Tue, May 08, 2012 at 05:19:40AM +0200, Frederik Schwarzer wrote:
> > Hi,
> >
> > I had a little problem with rindex and wrote a small demo code that
> > shows what I found.
> $ install/bin/perl6 -e 'say "perł".rindex("e");' perl
> substring not found
>   in method gist at src/gen/CORE.setting:8140
>   in sub say at src/gen/CORE.setting:6244
>   in block  at -e:1
> 
> $ install/bin/perl6 -v
> This is perl6 version 2012.03-27-g5793035 built on parrot 4.2.0 revision 
> RELEASE_4_2_0
> 
> 
> rindex appears to not like utf-8 encoded strings very much.

Good catch!  Now reported as Parrot issue #767 and RT #112818.

Pm



Re: Using precompiled modules, Assembling a project into one single file (pbc)

2011-06-17 Thread Patrick R. Michaud
On Fri, Jun 17, 2011 at 12:02:16PM +0200, Moritz Lenz wrote:
> >Also, if you look at the (pir) code for any compiled script,
> >it becomes clear that it uses some library called "perl6_ops".
> >Does this mean that the file can not be run on a machine
> >where you have installed parrot but have not installed perl6?
> 
> That is correct.
> Just consider the case where your program calls the eval() function
> - it needs the full Perl 6 compiler available. So you need rakudo
> installed to run Perl 6 scripts.

Not only the compiler for eval(), but you need the runtime 
libraries as well for all of the builtin types and functions.
The generated .pir files for a HLL program aren't nearly
sufficient.

By way of analogy, most C programs also require external libraries
to be installed and available before they can run.

Pm


Announce: Rakudo Star 2011.04 released

2011-04-27 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the April 2011 release of "Rakudo Star", a useful and usable
distribution of Perl 6.  The tarball for the April 2011 release is
available from .

Rakudo Star is aimed at "early adopters" of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These "Star" releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  The April 2011 Star release includes release #40
of the Rakudo Perl 6 compiler [1], version 3.3.0 of the Parrot 
Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.

This release of Rakudo Star adds the following features over the
previous Star release:
  * Modules MiniDBI, form, HTTP::Daemon, Yaml and Module::Tools are
removed in this release. 
  * New modules Pies (including panda, the module installer) and 
HTTP::Server::Simple have been added.
  * New implementation of IO::Socket::INET, with basic IPv6 support
  * -p and -n command-line options are now available
  * Many new IO improvements, including stat-related methods
  * New --ll-backtrace command-line switch for printing PIR level stack traces
  * Preliminary implementation of Infix 'orelse'
  * Added Str.indent
  * Bugfixes to negation meta operator
  * Support for complex conjugation

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Some of the not-quite-there features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex <[...]> character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed at .

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
An updated draft of a Perl 6 book is available as 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

Rakudo Star releases are created on a three-month cycle, or as 
needed in response to important bug fixes or improvements.  
(The Rakudo compiler will continue with monthly releases.)  
The next planned release of Rakudo Star will be in July 2011.

[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/


Re: Current vs future Perl 6 binary size

2011-04-22 Thread Patrick R. Michaud
On Fri, Apr 22, 2011 at 05:15:30PM +0200, Moritz Lenz wrote:
> After some futher analysis I found that perl6.pbc and the perl6 binary
> both are about 11MB in size - and 1.3MB when compressed with gzip.
> 
> So if anybody actually wants to do something about the size, teach
> parrot's pbc_to_exe compress the pbc, and uncompress into memory upon
> loading.

...this comes at the cost of not being able to mmap the bytecode,
though.  In other words, we save 10MB of disk space, but cause
each invocation of Rakudo to eat up 11MB of data memory instead
of being able to (potentially) mmap a shared copy.

> In the long run it might also be possible to come up with a more compact
> PBC format, but I guess that's much more work than compressing and
> decompressing.

Perhaps Lorito will be able to help here.  But ultimately the real
savings (both memory and startup time) will come when we can truly 
serialize Rakudo's subroutines and constant data structures.

Pm


Re: Current vs future Perl 6 binary size

2011-04-22 Thread Patrick R. Michaud
On Fri, Apr 22, 2011 at 10:27:47AM -0400, Guy Hulbert wrote:
> On Fri, 2011-22-04 at 09:09 -0500, Patrick R. Michaud wrote:
> > We can
> > actually make the "perl6" executable file itself as small as 
> > 50K, but the first thing it then does is load a several-megabyte
> > Parrot bytecode library.
> > 
> > But overall answer to your question -- yes, we expect that
> > improvements in Parrot (better serialization, better bytecode
> > formats, better object system) will enable us to significantly 
> > reduce the current size of the perl6 executable.  I don't know
> > by how much, but a 50% reduction in size doesn't seem unrealistic.
> 
> Does this 50% reduction in size apply to the library above (perl6 50kB,
> parrot lib sMB) ?

Yes -- the reductions primarily come from reductions in the bytecode
(which will be the same in both cases).

> Could one make further optimizations to the Parrot bytcode library via
> native libraries ?

Probably not -- at least not until there are some significant
changes to Parrot bytecode itself.  By "Parrot bytecode library"
above what I really mean is "Parrot bytecode that implements the 
Rakudo Perl 6 compiler and Perl 6 libraries."

Pm


Re: Current vs future Perl 6 binary size

2011-04-22 Thread Patrick R. Michaud
On Fri, Apr 22, 2011 at 12:33:45AM +0100, gvim wrote:
> The Perl 6 binary within the January release of Rakudo Star 
> is 10Mb on my Snow Leopard system. Do I take it that the 
> Perl 6 binary is [...] much larger than the current 
> Perl 5.12 (1.6Mb) or is it simply that the Perl 6 binary 
> is likely to lose more weight during the refinement process? 
> In other words, is there a ballpark for how big the 
> Perl 6 binary will be when development settles down?

Comparing any Perl 6 binary against the Perl 5 binary is
very much an apples-to-oranges comparison.  For one, Perl 6
has far more features than Perl 5 -- for a fairer comparison,
compare Perl 6 to (Perl 5 + Moose + Regexp::Grammars + ...).

Also, the Rakudo Perl 6 binary is not really a "binary" in the 
normal "machine code compiled from C" sense.  Most of what the 
"binary" contains is Parrot objects and bytecode.  We can
actually make the "perl6" executable file itself as small as 
50K, but the first thing it then does is load a several-megabyte
Parrot bytecode library.

But overall answer to your question -- yes, we expect that
improvements in Parrot (better serialization, better bytecode
formats, better object system) will enable us to significantly 
reduce the current size of the perl6 executable.  I don't know
by how much, but a 50% reduction in size doesn't seem unrealistic.

Pm


Announce: Rakudo Star 2011.01 released

2011-01-28 Thread Patrick R. Michaud
(Resending, since I had the wrong date in the subject line of
my previous post.  Apologies to everyone for the duplicates! --Pm)

On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the January 2011 release of "Rakudo Star", a useful and usable
distribution of Perl 6.  The tarball for the January 2011 release is
available from .

Starting with this January 2011 release, Rakudo Star releases will be
created on a three-month cycle, or as needed in response to important
bug fixes or improvements.  (The Rakudo compiler will continue with
monthly releases.)  The next planned release of Rakudo Star will be 
in April 2011.

Rakudo Star is aimed at "early adopters" of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These "Star" releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  The January 2011 Star release includes release #37
of the Rakudo Perl 6 compiler [1], version 3.0.0 of the Parrot 
Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.

This release of Rakudo Star adds the following features over the
previous Star release:
  * faster subroutine calls (type cache)
  * implemented 'handles Rolename' trait
  * 'use Devel::Trace' debugging pragma
  * improved parsing of keyword boundaries
  * faster .comb

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Some of the not-quite-there features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex <[...]> character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed at .

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
An updated draft of a Perl 6 book is available as 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/


Announce: Rakudo Star 2010.12 released

2011-01-28 Thread Patrick R. Michaud

On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the January 2011 release of "Rakudo Star", a useful and usable
distribution of Perl 6.  The tarball for the January 2011 release is
available from .

Starting with this January 2011 release, Rakudo Star releases will be
created on a three-month cycle, or as needed in response to important
bug fixes or improvements.  (The Rakudo compiler will continue with
monthly releases.)  The next planned release of Rakudo Star will be 
in April 2011.

Rakudo Star is aimed at "early adopters" of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These "Star" releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  The January 2011 Star release includes release #37
of the Rakudo Perl 6 compiler [1], version 3.0.0 of the Parrot 
Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.

This release of Rakudo Star adds the following features over the
previous Star release:
  * faster subroutine calls (type cache)
  * implemented 'handles Rolename' trait
  * 'use Devel::Trace' debugging pragma
  * improved parsing of keyword boundaries
  * faster .comb

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Some of the not-quite-there features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex <[...]> character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed at .

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
An updated draft of a Perl 6 book is available as 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/


Re: Questions for Survey about Perl

2011-01-02 Thread Patrick R. Michaud
On Sun, Jan 02, 2011 at 06:25:18PM +0100, Jan Ingvoldstad wrote:
> On Sun, Jan 2, 2011 at 18:05, Guy Hulbert  wrote:
> 
> On Sun, 2011-02-01 at 10:27 -0600, Patrick R. Michaud wrote:
> >   - What was the first production release of Linux?
> >   - At what point was each of the above declared a "production
> > release";
> > was it concurrent with the release, or some time afterwards?
> 
> Linus declared what his goals for 1.0 were and started a 0.9x series.
> 
> 
>   and so on.
> 
> While this meta discussion is all very nice, I don't really see what it has to
> do with the questionnaire.
> 
> Gabor didn't ask us to discuss the answers to the questions, he asked us to
> come up with more questions that we would like to see answered.

In order to put together a worthwhile survey, I think some "meta-discussions" 
about the questons/answers we're likely to encounter are important.  I also
think the existence of a survey itself is likely to re-open a variety of 
otherwise dormant Perl 6 discussions and threads (as it already has), so we 
should be cognizant of that potential impact.

Still, if others feel that the "production release" meta-discussion is too 
far off-topic for consideration in the questionnaire, I'll let it drop here 
and perhaps reintroduce it under another thread.

Pm


Re: Questions for Survey about Perl

2011-01-02 Thread Patrick R. Michaud
On Sat, Jan 01, 2011 at 12:53:17PM +0100, Daniel Carrera wrote:
> On Sat, Jan 1, 2011 at 12:36 PM, Moritz Lenz  wrote:
> 
> > Given the current version number scheme (year.month), it's highly
> > unlikely that we'll ever see a Rakudo 1.0.
> >
> > So I'd change that to "after a production release of a Perl 6 compiler"
> 
> People might be expecting that when Rakudo is ready it would have a
> 1.0 release. I sure did. Using year + month is nice in a way, but it
> means that you don't immediately know if the release is production vs
> devel, or whether it's a major vs minor release.

Out of curiosity (because I think it will illuminate some of the difficulty
Rakudo devs have in declaring something to be a "production release"): 

  - What constitues a "production release"?
  - What was the first production release of Perl 4?
  - What was the first production release of Perl 5?
  - What was the first production release of Linux?
  - At what point was each of the above declared a "production release";
was it concurrent with the release, or some time afterwards?

Pm


Announce: Rakudo Star 2010.12 released

2010-12-30 Thread Patrick R. Michaud

On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the December 2010 release of "Rakudo Star", a useful and usable
distribution of Perl 6.  The tarball for the December 2010 release is
available from .

Rakudo Star is aimed at "early adopters" of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These "Star" releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  The December 2010 Star release includes release #36
of the Rakudo Perl 6 compiler [1], version 2.11.0 of the Parrot 
Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.

This release of Rakudo Star adds the following features over the
previous Star release:
  * New .trans algorithm
  * Configuration improvements
  * More bug fixes

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Thus, we do not consider Rakudo Star to be a
"Perl 6.0.0" or "1.0" release.  Some of the not-quite-there
features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex <[...]> character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed at .

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
An updated draft of a Perl 6 book is available as 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

Starting with the January 2011 release, Rakudo Star releases will be
created on a three-month cycle, or as needed in response to important
bug fixes or improvements.  The next planned release of Rakudo Star
will be on January 25, 2011.

[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/


Announce: Rakudo Star 2010.11 released

2010-11-25 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the November 2010 release of "Rakudo Star", a useful and usable
distribution of Perl 6.  The tarball for the November 2010 release is
available from .

Rakudo Star is aimed at "early adopters" of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These "Star" releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  The November 2010 Star release includes release #35
of the Rakudo Perl 6 compiler [1], version 2.10.1 of the Parrot 
Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.

This release of Rakudo Star adds the following features over the
previous Star release:
  * qw// is implemented
  * The .trans method is 5x faster
  * Indexing with ranges and Whatever offsets now works

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Thus, we do not consider Rakudo Star to be a
"Perl 6.0.0" or "1.0" release.  Some of the not-quite-there
features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex <[...]> character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed at .

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
An updated draft of a Perl 6 book is available as 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

Rakudo Star releases are created on a monthly cycle or as needed
in response to important bug fixes or improvements.  The next planned 
release of Rakudo Star will be on December 28, 2010.

[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/


Announce: Rakudo Star 2010.10 released

2010-10-28 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the October 2010 release of "Rakudo Star", a useful and usable
distribution of Perl 6.  The tarball for the October 2010 release is
available from .

Rakudo Star is aimed at "early adopters" of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These "Star" releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  The October 2010 Star release includes release #34
of the Rakudo Perl 6 compiler [1], version 2.9.0 of the Parrot 
Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.

This release of Rakudo Star adds the following features over the
previous Star release:
  * A simple implementation of 'require'
  * Local timezone is available in $*TZ
  * Implementations of ms// ss/// (samespace)
  * Speed improvements to Str.flip
  * Hyperoperator versions of +=
  * Improved diagnostic messages and warning messages
  * True and False now stringify properly
  * Attribute modification via introspection

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Thus, we do not consider Rakudo Star to be a
"Perl 6.0.0" or "1.0" release.  Some of the not-quite-there
features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex <[...]> character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed at .

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
An updated draft of a Perl 6 book is available as 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

Rakudo Star releases are created on a monthly cycle or as needed
in response to important bug fixes or improvements.  The next planned 
release of Rakudo Star will be on November 23, 2010.

[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/
[3] http://github.com/perl6/roast


Announce: Rakudo Star 2010.09 released

2010-09-29 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the September 2010 release of "Rakudo Star", a useful and usable
distribution of Perl 6.  The tarball for the September 2010 release is
available from .

Rakudo Star is aimed at "early adopters" of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These "Star" releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  The September 2010 Star release includes release #33
of the Rakudo Perl 6 compiler [1], version 2.8.0 of the Parrot 
Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.

This release of Rakudo Star adds the following features over the
previous Star release:
  * Several performance improvements have been implemented;
notably in the slurp() and reverse() functions
  * The series operator has been refactored and updated to the current 
specification
  * Temporal objects (DateTime, Date, Instant, and Duration) are now 
completely implemented
  * Enumeration objects now conform much closer to the specification
  * 'now' and 'time' are now terms instead of functions.  This means
you can write 'time - 1' and it will do what you mean, but
   'time()' is no longer valid.
  * The Perl 6 specification tests [3] are now included in the distribution.

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Thus, we do not consider Rakudo Star to be a
"Perl 6.0.0" or "1.0" release.  Some of the not-quite-there
features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex <[...]> character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed.

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
An updated draft of a Perl 6 book is available as 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

Rakudo Star releases are created on a monthly cycle or as needed
in response to important bug fixes or improvements.  The next planned 
release of Rakudo Star will be on October 26, 2010.

[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/
[3] http://github.com/perl6/roast


Re: flushing a file

2010-09-15 Thread Patrick R. Michaud
On Wed, Sep 15, 2010 at 08:42:48AM +0200, Gabor Szabo wrote:
> Can I rely in Perl 6 that a file is flushed and closed correctly when
> Perl shuts down?

I don't know the answer to this question, but I suspect "yes".

> The probably more interesting case is this:
> 
> #!/usr/bin/perl6
> use v6;
> 
> my $filename = "temp.txt";
> 
> {
> my $fh = open $filename, :w;
> $fh.say("hello world");
> }
> ...
> Can I be sure that the file is already flushed and closed when $fh
> goes out of scope
> or do I need to explicitly call $fh.close in the first block?

You need to explicitly call $fh.close.

Pm


Announce: Rakudo Star 2010.08 released

2010-08-26 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the August 2010 release of "Rakudo Star", a useful and usable
distribution of Perl 6.  The tarball for the August 2010 release is
available from .

Rakudo Star is aimed at "early adopters" of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These "Star" releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  The August 2010 Star release includes release #32
of the Rakudo Perl 6 compiler [1], version 2.7.0 of the Parrot 
Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.

This release of Rakudo Star adds the following features over the
previous Star release:
  * Nil is now undefined
  * Many regex modifiers are now recognized on the outside of regexes
  * Mathematic and range operations are now faster (they're still slow,
but they're significantly faster than they were in the previous release)
  * Initial implementations of .pack and .unpack
  * MAIN can parse short arguments
  * Removed a significant memory leak for loops and other repeated blocks

This release (temporarily?) omits the Config::INI module that was
included in the 2010.07 release, as it no longer builds with the 
shipped version of Rakudo.  We hope to see Config::INI return soon.

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Thus, we do not consider Rakudo Star to be a
"Perl 6.0.0" or "1.0" release.  Some of the not-quite-there
features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex <[...]> character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed.

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
An updated draft of a Perl 6 book is available as 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

Rakudo Star releases are created on a monthly cycle or as needed
in response to important bug fixes or improvements.  The next planned 
release of Rakudo Star will be on September 28, 2010.

[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/


Re: implementing every(N)

2010-07-30 Thread Patrick R. Michaud
On Fri, Jul 30, 2010 at 09:17:30AM -0500, Ted Zlatanov wrote:
> I have a Perl 5 module called Every which provides, simply,
> 
> every(5); # true on invocation 5, 10, etc.
> every(seconds => 5); # true at 5, 10, etc. seconds
> 
> It's really nice in endless loops, logging, etc.  I'd like to translate
> it to Perl 6 (using Rakudo specifically).
> 
> Its current implementation requires Devel::Opcode because it needs to
> know what location is getting called again and again.
> 
> Generally for Perl 6, is there a simple way to make Every obsolete by
> using built-ins?  I'd love that but haven't seen anything in the
> language that would help.  

I suspect something like CALLER::<$?FILE> and CALLER::<$?LINE>  might
eventually do what you want -- they would at least get to a unique
line within the calling.  CALLER:: and $?FILE and $?LINE are not
yet implemented in Rakudo, but I suspect the language specification
has sufficient features to eventually make a clean implementation a 
possibility.

Pm


Re: Perl6 Modules - Documentation

2010-07-30 Thread Patrick R. Michaud
On Fri, Jul 30, 2010 at 04:08:49PM +0400, Richard Hainsworth wrote:
> On 07/30/2010 01:27 PM, Steffen Schwigon wrote:
> >Richard Hainsworth  writes:
> >>I am not aware that there is a convenient way of obtaining a short
> >>description about each module, other than just the name?
> >
> >Perl without CPAN feels like Kung-Fu on stack-heel shoe.
> 
> CPAN as a concept is not the issue. CPAN IS what makes perl so superior.
> 
> The problem at the moment is the variety of suggested enhancements
> to CPAN, which does have its own issues.
> 
> There is an inevitable transition period between now (the release of
> the Rakudo Star distribution) and some point down the timeline when
> it will become clear how to arrange a CPAN-type setup for Perl6 (not
> just the Rakudo implementation of perl6).

Amen.

Speaking as the overall manager for Rakudo-related stuff, Rakudo's
current stance on anything module-management related is going to be 
"rough consensus and running code".  In other words, ideas and
proposals are welcomed, but actual code and implementations are
likely to have the greatest influence on the ultimate details and
specfication.

> All I am suggesting is that the directories containing modules also
> contain a METADATA file with some standard items, and that this
> metadata is required for a module that is registered. Even if there
> is a CPAN system, the metadata would still be needed, so there is no
> extra work for developers.

I would also like to express a desire that we follow many of the principles
expressed by Miyagawa's excellent "cpanminus" utility[1] for CPAN.  In 
particular, it should be possible to have a basic module installer and 
manager that performs basic module functions and has few (ideally zero)
external module dependencies.

Pm

[1] http://search.cpan.org/~miyagawa/App-cpanminus-1.0006/lib/App/cpanminus.pm


Rakudo Star - a useful, usable, "early adopter" distribution of Perl 6

2010-07-29 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the July 2010 release of "Rakudo Star", a useful and usable
distribution of Perl 6.  The tarball for the July 2010 release is
available from .

Rakudo Star is aimed at "early adopters" of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These "Star" releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
("Perl 6") and specific implementations of the language such as
"Rakudo Perl".  "Rakudo Star" is a distribution that includes
release #31 of the Rakudo Perl 6 compiler [1], version 2.6.0 of
the Parrot Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.  We
plan to make Rakudo Star releases on a monthly schedule, with
occasional special releases in response to important bugfixes or
changes.

Some of the many cool Perl 6 features that are available in this
release of Rakudo Star:
  * Perl 6 grammars and regexes
  * formal parameter lists and signatures
  * metaoperators
  * gradual typing
  * a powerful object model, including roles and classes
  * lazy list evaluation
  * multiple dispatch
  * smart matching
  * junctions and autothreading
  * operator overloading (limited forms for now)
  * introspection
  * currying
  * a rich library of builtin operators, functions, and types
  * an interactive read-evaluation-print loop
  * Unicode at the codepoint level
  * resumable exceptions

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Thus, we do not consider Rakudo Star to be a
"Perl 6.0.0" or "1.0" release.  Some of the not-quite-there
features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex <[...]> character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed.

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.

Rakudo Star also bundles a number of modules; a partial list of
the modules provided by this release include:
  * Blizkost
  - enables some Perl 5 modules to be used from within Rakudo Perl 6
  * MiniDBI
  - a simple database interface for Rakudo Perl 6
  * Zavolaj
  - call C library functions from Rakudo Perl 6
  * SVG and SVG::Plot
  - create scalable vector graphics
  * HTTP::Daemon
  - a simple HTTP server
  * XML::Writer
  - generate XML
  * YAML
  - dump Perl 6 objects as YAML
  * Term::ANSIColor
  - color screen output using ANSI escape sequences
  * Test::Mock
  - create mock objects and check what methods were called
  * Math::Model
  - describe and run mathematical models
  * Config::INI
  - parse and write configuration files
  * File::Find
  - find files in a given directory
  * LWP::Simple
  - fetch resources from the web

These are not considered "core Perl 6 modules", and as module
development for Perl 6 continues to mature, future releases
of Rakudo Star will likely come bundled with a different set
of modules. Deprecation policies for bundled modules will be
created over time, and other Perl 6 distributions may choose
different sets of modules or policies.  More information about
Perl 6 modules can be found at http://modules.perl6.org/.

Rakudo Star also contains a draft of a Perl 6 book -- see 
 in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see , ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

Rakudo Star releases are created on a monthly cycle or as needed
in response to important bug fixes or improvements.  The next planned 
release of Rakudo Star will be on August 24, 2010.

[1] http://github.com/rakudo/rakud

Re: A suggestion about parrot sugar

2010-06-25 Thread Patrick R. Michaud
On Fri, Jun 25, 2010 at 06:31:57AM +, Xi Yang wrote:
> 
> For example: "use parrot Foo::Bar", which would load parrot 
> library under Foo/Bar. However, this would be easy and useful 
> for rakudo, but would not for other possible Perl6 implementations.   
>   
I think the syntax that we've settled on is

use Foo::Bar:from;

I even think this worked in Rakudo at one time, but I don't know
if that's still the case.  (We can certainly get it working again.)

Pm



Re: Something wrong with str.reverse

2010-06-21 Thread Patrick R. Michaud
On Mon, Jun 21, 2010 at 09:47:37AM +0100, Smylers wrote:
> Larry Wall writes:
> > On Fri, Jun 18, 2010 at 11:21:52AM +0200, Jan Ingvoldstad wrote:
> > : On Fri, Jun 18, 2010 at 11:15, Smylers  wrote:
> > : 
> > : > For the benefit of Perl 5 programmers used to string reverse it
> > : > would be nice to have a warning if reverse is invoked with exactly
> > : > one string argument (but not with an array which happens to
> > : > contain a string as its only element).
> > : 
> > : Such warnings can become quite awful as Perl 6 grows and matures.
> 
> I was only thinking about that specific warning, not generally warnings
> that might be of use to Perl 5 programmers. And I don't see how warning
> about calling reverse on a scalar would be awful.
> 
> It isn't something that makes sense to do (it's a no-op), and it isn't
> just former Perl 5 programmers who might make that mistake; anybody who
> does could be warned about it.

On the other hand, many of our other list-y methods also work on
scalars (treating them as a list of 1 element -- essentially a no-op):  
.join, .sort, .any, .all, .rotate, .max, .min, .pick, .reduce, .values,
etc.  It might be inconsistent that .reverse on a scalar warns when 
the others do not.

Personally, I'm fine with .reverse issuing a warning when it appears on
a scalar, but doing so will be inconsistent with the pattern of the
other list methods on scalars.

Pm


Announce: Rakudo Perl 6 Development Release #25 ("Minneapolis")

2010-02-01 Thread Patrick R. Michaud
[This notice is going out a bit late; the release was indeed
produced on time, but I was delayed in sending out this notice.
With apologies for the delay...  --Pm]

On behalf of the Rakudo development team, I'm pleased to announce the
January 2010 development release of Rakudo Perl #25 "Minneapolis".
Rakudo is an implementation of Perl 6 on the Parrot Virtual Machine
(see http://www.parrot.org).  The tarball for the January 2010 release
is available from http://github.com/rakudo/rakudo/downloads .

Rakudo Perl follows a monthly release cycle, with each release 
code named after a Perl Mongers group.  The January 2010 release 
is code named "Minneapolis" for Minneapolis.pm, hosts of the annual 
Frozen Perl Workshop [1].  In 2009 the Frozen Perl Workshop featured a 
one-day hackathon for Perl 6 and Rakudo development, which ultimately 
informed the design and implementation of the current build system.
(The 2010 Frozen Perl Workshop will be on February 6, 2010, for those
interested in attending.)

Shortly after the October 2009 (#22) release, the Rakudo team began a new
branch of Rakudo development ("ng") that refactors the grammar to much more
closely align with STD.pm as well as update some core features that have been
difficult to achieve in the master branch [2, 3].  We had planned for
this release to be created from the new branch, but holiday vacations
and other factors conspired against us.  This is absolutely the final 
release from the old development branch; we expect to make the new branch 
the official "master" branch shortly after this release.

This release of Rakudo requires Parrot 2.0.0.  One must still
perform "make install" in the Rakudo directory before the "perl6"
executable will run anywhere other than the Rakudo build directory.
For the latest information on building and using Rakudo Perl, see the
README file section titled "Building and invoking Rakudo".

Some of the specific changes and improvements occuring with this
release include:

* Rakudo is now passing 31,957 spectests, or 85.7% of the available
  test suite.  This is roughly the same level as the December 2009
  release (because most effort has taken place in the "ng" branch
  as described above).

* Rakudo's calling conventions have been updated to match changes
  in Parrot 2.0.0's calling and context structures.

The Perl 6 language specification is still in flux. Please take note of the
following changes, which might affect your existing programs. In the next
release of Rakudo, the deprecated features will likely be gone.

* The root of the object hierarchy has been changed from 'Object' to 'Mu'.
  The type 'Object' goes away.

* The term 'undef' is gone. You can replace it with other constructs,
  depending on context:
- 'Nil' is undefined in item context, and the empty list in list context
- 'Mu' is the most general undefined value which does not flatten in list
  context
- as a smart matching target, you can replace '$obj ~~ undef'
  by '$obj ~~ *.notdef'

* Builtin classes will derive from 'Cool' (which itself derives from 'Any').
  Most of the builtin methods on these classes will be defined in the
  'Cool' class instead of 'Any'.  See Synopsis 2 for more details.

* Starting with the next release, we will likely switch to using
  ".MM" instead of "-MM" (dot instead of hyphen) as release 
  identifiers.  This is intended to simplify building and packaging
  for other distribution systems.

The development team thanks all of our contributors and sponsors for
making Rakudo Perl possible.  If you would like to contribute,
see http://rakudo.org/how-to-help , ask on the perl6-compi...@perl.org
mailing list, or ask on IRC #perl6 on freenode.

The next release of Rakudo (#26) is scheduled for February 18, 2010.
A list of the other planned release dates and codenames for 2010 is
available in the "docs/release_guide.pod" file.  In general, Rakudo
development releases are scheduled to occur two days after each
Parrot monthly release.  Parrot releases the third Tuesday of each month.

Have fun!

[1] http://www.frozen-perl.org/
[2] http://use.perl.org/~pmichaud/journal/39779
[3] http://use.perl.org/~pmichaud/journal/39874


  1   2   >