[perl #61628] Null PMC access when trying to numify Whatever stars in Rakudo

2008-12-24 Thread Carl Mäsak
# New Ticket Created by  Carl Mäsak 
# Please include the string:  [perl #61628]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61628 


masak rakudo: +*
p6eval rakudo 34276: OUTPUT«Null PMC access in get_number()␤ [...]
* masak cackles evilly
* masak submits rakudobug

I imagine it's an error to try to numify a Whatever star. But perhaps
not that error.


[perl #61638] [PATCH] Fixed typos in docs

2008-12-24 Thread Saleem A. Ansari (via RT)
# New Ticket Created by  Saleem A. Ansari 
# Please include the string:  [perl #61638]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61638 


Fixed typos in docs.

 book/ch01_overview.pod   |   10 +-
 book/ch03_pir_basics.pod |2 +-
 imcc/imcfaq.pod  |4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
Index: docs/book/ch01_overview.pod
===
--- docs/book/ch01_overview.pod	(revision 34295)
+++ docs/book/ch01_overview.pod	(working copy)
@@ -25,7 +25,7 @@
 working hard on a spec for Python 3000. The Perl 6 project started
 moving in two different directions at once: the underlying interpreter
 architecture and the language grammar and semantics. As people
-realized that the two projects could become completely indepent, it
+realized that the two projects could become completely independent, it
 was decided to create a proper language-agnostic virtual machine to
 support the high-level efforts. The virtual machine was later dubbed
 Parrot in a fitting turn of life imitating art.
@@ -105,7 +105,7 @@
 members of the Project Team, or may be held jointly. The Architect also
 works with the Release Managers to develop and maintain the release
 schedule. Allison RandalXRandal, Allison currently leads the Parrot
-project aschief architect.
+project as chief architect.
 
 =item Release Managers
 
@@ -166,7 +166,7 @@
 Contributors who submit numerous, high-quality patches may be
 considered to become a Committer. Committers have commit access to the
 full Parrot repository, but generally work only on one or more
-subprojects; Committer categories are described below. Contributors may
+subprojects; Committer categories are described below. Contributors may be
 considered for commit access either by being nominated by another
 Committer, or by requesting it.
 
@@ -194,7 +194,7 @@
 =item Build Manager
 
 Build Managers maintain and extend configuration and build subsystems.
-They reviews smoke reports and attempt to extend platform support.
+They review smoke reports and attempt to extend platform support.
 
 =item Lead Tester
 
@@ -225,7 +225,7 @@
 
 Parrot's cage, the development working environment, has a tendency to
 get messy and disorganized over time. It's the responsibility of the
-aptly-named Cage Cleaners to ensure coding standards are followed, that
+aptly-named Cage Cleaners to ensure that coding standards are followed, that
 documentation is complete and accurate, that all tests are functioning
 properly, and that there are plenty of coding examples for new users to
 learn from. A class of tickets in the RT tracking system has been created
Index: docs/book/ch03_pir_basics.pod
===
--- docs/book/ch03_pir_basics.pod	(revision 34295)
+++ docs/book/ch03_pir_basics.pod	(working copy)
@@ -106,7 +106,7 @@
 register data is held. A memory allocator unit translates register names
 in the form $S0 into an actual fixed memory location. This allocator
 can also help to optimize register usage so that existing registers are
-reused instead of allocating new ones in memory. The sort version is that
+reused instead of allocating new ones in memory. The short version is that
 the programmer should never have to worry about register allocation, and
 should feel free to use as many as she wants. As with any system, it's
 a good idea to be mindful of the things that might impact performance
Index: docs/imcc/imcfaq.pod
===
--- docs/imcc/imcfaq.pod	(revision 34295)
+++ docs/imcc/imcfaq.pod	(working copy)
@@ -146,9 +146,9 @@
 
 For more examples see the PIR tutorial in Fexamples/tutorial.
 
-=head2 How do I compile and run an PIR module?
+=head2 How do I compile and run a PIR module?
 
-Parrot uses the filename extension to detect whether the file is an PIR file
+Parrot uses the filename extension to detect whether the file is a PIR file
 (.pir), a Parrot Assembly file (.pasm) or a pre-compiled
 bytecode file (.pbc).
 


[perl #55962] [BUG] Match object, 'split' method generates Strings, not Perl6Str

2008-12-24 Thread Patrick R. Michaud via RT

The latter issue is now fixed in r34324:

$ ./parrot perl6.pbc
 my @foo = 'AB'.split(''); @foo[0]++; say @foo;
BB


The other issue with match objects depends on how one invokes a named
regex; I'm going to say we don't worry about that until we get a
clarification on the spec.

So, this issue seems to be fixed -- I'm assigning the ticket to moritz++
so we can make sure a good test case is in the spectest suite.  After
that this ticket can be closed.

Thanks!

Pm


[perl #57978] Implement last/redo/next/continue control exceptions

2008-12-24 Thread Patrick R. Michaud via RT
On Thu Oct 23 07:13:46 2008, pmichaud wrote:
 On Wed, Oct 22, 2008 at 08:27:10PM -0700, Tim Nelson via RT wrote:
  On Sat Aug 16 07:29:31 2008, je...@perl.org wrote:
   - Needs last/redo/next/continue exceptions in PCT (PCT)
  
  
  This is done in rakudo; does that mean that this ticket is done?  
 
 Only 'next' is done in rakudo at the moment.

Now all of 'last', 'next', and 'redo' are done, so closing ticket.

Pm




[perl #57978] Implement last/redo/next/continue control exceptions

2008-12-24 Thread Patrick R. Michaud via RT
On Thu Oct 23 07:13:46 2008, pmichaud wrote:
 On Wed, Oct 22, 2008 at 08:27:10PM -0700, Tim Nelson via RT wrote:
  On Sat Aug 16 07:29:31 2008, je...@perl.org wrote:
   - Needs last/redo/next/continue exceptions in PCT (PCT)
  
  
  This is done in rakudo; does that mean that this ticket is done?  
 
 Only 'next' is done in rakudo at the moment.

Now all of 'last', 'next', and 'redo' are done, so closing ticket.

Pm




[perl #61642] new hash .perl dump format and eval

2008-12-24 Thread via RT
# New Ticket Created by  Ilya Belikin 
# Please include the string:  [perl #61642]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61642 


Hi,
I am trying  force November works on r34320, and look like found rakudobug:

 say { foo = 1}.perl;
{(foo = 1)} # looks strange, I think it should be just {foo = 1}.

and after, that produce problem when we try to eval this str:

 sub foo { eval '{ her = 1, foo = 5, bar = 5, baz = 2 }' }; my $a 
 = foo(); say $a.perl;
{(baz = 2), (her = 1), (foo = 5), (bar = 5)}

 sub foo { eval '{ (her = 1), (foo = 5), (bar = 5), (baz = 2) }' 
 }; my $a = foo(); say $a.perl;
[(her = 1), (foo = 5), (bar = 5), (baz = 2)] # ouch!

 sub foo { eval '{ (her = 1), (foo = 5), (bar = 5), (baz = 2) }' 
 }; my %a = foo(); say %a.perl;
{(baz = 2), (her = 1), (foo = 5), (bar = 5)}

ihrd


Padre 0.22, Padre::Plugin::Parrot and Padre::Plugin::Perl6 released!

2008-12-24 Thread Gabor Szabo
Hi,

as this is relevant to you as well, let me send this announcement here too.

Yesterday we have released v0.22 of Padre the Perl IDE written in Perl 5.
http://padre.perlide.org/

There are many changes as usual but the two important ones for the Parrot/Perl 6
developers are related mostly to two plug-ins of Padre:

1) The Padre::Plugin::Parrot allows the embedding of PASM code in
Padre. This means
you could actually add plug-ins to Padre written in Perl. With the
further enhancement
of Parrot::Embed (and specifically Parrot::Interpreter) we will be
able to write plug-ins
to Padre in any of the languages running on Parrot. (See tickets
#74, #75, #76, #79)
on https://trac.parrot.org/parrot/report/1

2) Padre::Plugin::Perl6, written by Ahmad Zawawi uses STD.pm to provide slow but
 correct syntax highlighting and syntax checking of Perl 6code.
As we have discussed on #padre it is very slow so it can only be
used for really small
files but I hope it will be improved soon. In any case I am really
happy that we have
any kind of *correct* Perl 6 parsing on Christmas Eve 2008.

To install Padre you need Perl 5 compiled with threads and then run

cpan install Padre

Further help can be found on http://padre.perlide.org/wiki/Download/
or on #padre

Following is the original announcement of Steffen Mueller.

regards
   Gabor

-- Forwarded message --
From: Steffen Mueller smuel...@cpan.org
Date: Tue, Dec 23, 2008 at 9:08 PM
Subject: [Padre-dev] Padre 0.22 released!
To: Padre development discussion list padre-...@perlide.org,
padre-n...@perlide.org


Dear Padre users and developers,

Padre version 0.22 has just been uploaded to the PAUSE. That means it
will propagate to the CPAN mirrors without a few hours. Like the
previous release, the list of changes is quite long, but one particular
achievement is support for highlighting Perl6 code and checking its
syntax if Padre::Plugin::Perl6 is available. Christmas is close.

Once the distribution has reached your CPAN mirror, you will be able to
access the full Change Log at
http://search.cpan.org/src/SMUELLER/Padre-0.22/Changes

The next Padre release is very preliminarily scheduled for December 28th
or 29th and we're still looking for a new release engineer.

Best regards,
Steffen

___
Padre-dev mailing list
padre-...@perlide.org
http://mail.perlide.org/mailman/listinfo/padre-dev


Re: Optimizing PMC-based MMD

2008-12-24 Thread Allison Randal

chromatic wrote:


Within the cmp op bodies, we *know* the arity and most of the types of MMD-
participant arguments at compile time.  We can get the types of PMC 
participants within the body of the op itself.  Thus we could avoid most of 
the argument marshalling and counting and analysis if we had a way to perform 
cached MMD lookup without constructing a CallSignature PMC.  That would clear 
up a third of the work.


This we should open up to general discussion. The consequence of 
short-cutting like this is that individual PMCs will no longer be able 
to override 'cmp' to do something other than multi-dispatch. At the 
moment, developers still have the option of providing their own quick 
comparison, which gives an even more extreme speedup than this shortcut.


So, question for language developers and other PMC developers, how 
important is the ability to define a 'cmp' vtable function that's called 
when the 'cmp' opcode is invoked? Or, is defining a 'cmp' multi for your 
PMC type enough?


Another area for optimization is invoking a Sub from a signature PMC; I 
believe we're throwing away and recalculating valuable information, though we 
may have to wait for dramatic improvements until we can unify contexts and 
CallSignature.


Providing a new way of invoking Subs that uses CallSignatures all the 
way down is already planned in the coming series of calling conventions 
refactors.


The final opportunity for optimization is making the PMC multis defined in 
PMCs use PCC instead of C calling conventions.  Corresponding multis written 
in PIR already use PCC, and we want to support that, so we should unify our 
approach.  That would remove the NCI expense here, though that's probably 
minor in comparison to the CallSignature PMC expense.


Changing all NCI calls to something more like PCC calls is already 
planned in the coming series of calling conventions refactors. Changing 
the Pmc2c generator to build PCC subs instead of NCI Subs is a quick 
change that could happen now.


The calling conventions refactors are non-critical (some will likely 
land after 1.0), because the interface will stay the same, it's only the 
internals that will change.


Allison


Re: Optimizing PMC-based MMD

2008-12-24 Thread Patrick R. Michaud
On Wed, Dec 24, 2008 at 09:55:58AM -0600, Allison Randal wrote:
 Within the cmp op bodies, we *know* the arity and most of the types of MMD-
 participant arguments at compile time.  We can get the types of PMC  
 participants within the body of the op itself.  Thus we could avoid 
 most of the argument marshalling and counting and analysis if we had a 
 way to perform cached MMD lookup without constructing a CallSignature 
 PMC.  That would clear up a third of the work.

 This we should open up to general discussion. The consequence of  
 short-cutting like this is that individual PMCs will no longer be able  
 to override 'cmp' to do something other than multi-dispatch. 

Does individual PMCs here mean PMC instance or PMC classes?  I.e.,
are you saying that a specific PMC instance could choose to override
the cmp opcode for that individual PMC?  If so, do we have any examples
where this is being done now?

 At the  
 moment, developers still have the option of providing their own quick  
 comparison, which gives an even more extreme speedup than this shortcut.

 So, question for language developers and other PMC developers, how  
 important is the ability to define a 'cmp' vtable function that's called  
 when the 'cmp' opcode is invoked? Or, is defining a 'cmp' multi for your  
 PMC type enough?

From a Rakudo perspective, the ability to define custom 'cmp' vtable
functions doesn't appear to be at all important.  Comparisons are
almost invariably done by invoking :multi Sub PMCs of one form or 
another and letting those handle the MMD dispatch.  The opcode form 
seems to impose too many limitations to be used directly.

To turn the question around a bit: I can tell that a lot of work
has gone into Parrot to make MMD possible at the vtable level,
but I haven't see how vtable MMD is at all useful or usable in
languages where operator overloading is possible from the HLL itself.
And most dynamic languages I'm looking at seem to support that
in one form or another.

If someone (Allison) could make an example of how vtable MMD is 
intended to improve things -- i.e., taking an HLL language
statement and showing how that translates to PIR that is improved
by vtable MMD, that would be very helpful.

 The calling conventions refactors are non-critical (some will likely  
 land after 1.0), because the interface will stay the same, it's only the  
 internals that will change.

Oh, I'm very disappointed to hear this.  Named and positional argument
handling still has an odd behavior [*], and Perl 6 still really
needs the :lookahead option described earlier in the year.  I thought
that was going to be made possible by the refactor, and is partially
why PDS had calling conventions schedule for the December 2008 release.

[*]  Currently named parameters are filled from any leftover positionals
 in the argument list -- there's no way to declare an argument that
 can _only_ be filled by name, short of defining a :slurpy array 
 that grabs any extra positional arguments and then checking
 that the slurpy is empty.
   
And, Jonathan can correct me on this if I'm mistaken, but
I suspect the other big reason that calling convention refactor was 
scheduled for the December 2008 release is that it's likely a blocker 
or important component for the custom dispatcher that Jonathan will 
be creating for Rakudo as part of his funded grant.  That's due to be 
completed by the end of January, IIRC.

Pm


Re: [perl #57400] Working with %*ENV in Rakudo is difficult

2008-12-24 Thread Patrick R. Michaud
Instead of duplicating the method calls, a simpler approach might be
to create a Perl6Env class that has Env and Mapping as parents, then
change %*ENV to create a Perl6Env instead of a Env.  This should
cause %*ENV to inherit all of Mapping's methods.  (For other examples,
see how Mapping, List, and Complex are set up to inherit from Parrot
built-in PMC types.)

This might also make it easier for us to create proxies that do
the correct thing with the real environment when values are stored
into %*ENV.

Thanks!

Pm

On Wed, Dec 24, 2008 at 10:19:23AM -0800, Cory Spencer via RT wrote:
 
 This patch maps %*ENV onto the Mapping interface, allowing the
 fmt/keys/kv/pairs/values methods to work.
 
 Please let me know if their are any issues to be corrected in it!
 
 Thanks,
 
 Cory
 
 On Tue Nov 11 13:59:46 2008, pmichaud wrote:
  On Thu Oct 16 06:31:14 2008, masak wrote:
   Here's a thorough investigation of the strange properties of %*ENV.
  
  Here's an explanation -- I'll start with the summary first and then look
  at the examples.
  
   In summary:
   
   1. Ordinary strings and strings in %*ENV are unequally treated. You
  can call
   .trans(), or .trans([]) on the former, but you have to send in two non-
   invocant arguments to the latter.
  
  Rakudo's %*ENV is simply an instance of Parrot's Env PMC.  Whenever we
  fetch something from the Env PMC, we get back a String PMC.  This isn't
  a full Rakudo Str object, though, so their behaviors are a bit latter.
  
  In particular, Parrot's String PMC already has a .trans method defined
  on it, so Rakudo's .trans method for Str doesn't override it.
  
   2. The result of a successful .trans call on an %*ENV item returns
  something
   which, when touched in any way, causes Rakudo to explode.
  
  The .trans method on String PMC doesn't return a value at all -- it does
  an inplace modification.  So, the return value is garbage that indeed
  causes Parrot to go boom.
  
   3. Actively modifying the %*ENV item using .=trans produces a Null PMC
   access
   in another Parrot sub, and doing this from within a subroutine, produces
   a Null
   PMC acces in yet another Parrot sub.
  
  Since %*ENV returns a Parrot String PMC, and since the .trans method on
  the String PMC returns garbage, the inplace modifier ends up trying to
  store garbage back into the String PMC.
  
   4. Setting an %*ENV item using infix:= has no effect. Setting it using
   infix::= works. 
  
  The values that come back from %*ENV are String PMCs that aren't tied to
  the environment at all, thus assigning to those PMCs has no effect.
  
  However, binding an item using := does activate the set_*_keyed VTABLE
  of the underlying Env PMC, so that does work.
  
   Setting %*ENV itself using infix:= produces a Parrot VM
   error.
  
  The Env PMC is a singleton PMC that doesn't understand assignment. 
  We'll need to map this somehow so that it understands how to rebuild
  itself from a list or hash. 
  
   Setting it using infix::= works. 
  
  You can rebind %*ENV to a different hash, but then it loses its magical
  Env properties.  (This may also end up being the case for infix:=
 above.)
  
   Assigning %*ENV to another
   variable
   using infix:= produces another Parrot VM error.
  
  The Parrot Env PMC is a singleton PMC, so apparently there's not a way
  to clone or copy it.  This will probably be fixed via ObjectRefs, if
  it's not fixed already.
  
   5. When calling the methods .keys, .values, .kv or .perl on %*ENV,
  something
   fails with No applicable methods. 
  
  Since %*ENV (and the Env PMC) is not really a Hash or Mapping, none of
  those methods yet apply.  This is probably fixable if we map the Env PMC
  onto Rakudo's Mapping class.
  
  
  So, with those points out of the way, here are the explanations of the
  examples:
  
  
   say %*ENVQ.WHAT;
   # Str
  
  %*ENVQ actually returns a Parrot String PMC, which we've mapped onto
  the Rakudo Str type, so it reports 'Str' as its type (even though it
 isn't).
  
   say %*ENVQ.trans();
   # too few arguments passed (1) - 3 params expected
  
  Since the String PMC has its own .trans method, the Str.trans method
  doesn't get invoked (and the signatures are different).
  
  
   say %*ENVQ.trans( [], [] );
   # Null PMC access in get_string()
   say %*ENVQ.trans( [], [] ).WHAT;
   # Null PMC access in find_method()
  
  This invocation matches the signature for String.trans (not Str.trans),
  but that .trans is an inplace modification that returns PMCNULL.
  
   
   %*ENVQ .= trans([ A = B ], [])'
   # Null PMC access in name()
  
  This ends up calling %*ENVQ.trans( ... ), which returns PMCNULL and
  cannot be assigned back to %*ENVQ.
  
   %*ENVA = OH HAI; say %*ENVA.perl
   # 
   %*ENVA := OH HAI; say %*ENVA.perl
   # OH HAI
  
  Assignment doesn't work, but binding does.
  
  
  
  Hope this helps -- I'll see which of the above I can clean up.
  
  Pm
 
 




Multi constraints and specificity

2008-12-24 Thread Mark J. Reed
I thought this would work:

multi th($x where { $x % 10 == 1 }) { {$x}st }
multi th($x where { $x % 10 == 2 }) { {$x}nd }
multi th($x where { $x % 10 == 3 }) { {$x}rd }
multi th($x) { {$x}th }

say th(22)

but it yields 22th.  Is this a Rakudo bug or me not understanding
how constraints work?

-- 
Mark J. Reed markjr...@gmail.com


Re: Multi constraints and specificity

2008-12-24 Thread Mark J. Reed
Ok, it works with a $^var in place of $x in the where block.Should
the parameter be visible there under its declared name?  If not, then
this is clearly just pilot error, and never mind...

On Wed, Dec 24, 2008 at 6:47 PM, Mark J. Reed markjr...@gmail.com wrote:
 I thought this would work:

 multi th($x where { $x % 10 == 1 }) { {$x}st }
 multi th($x where { $x % 10 == 2 }) { {$x}nd }
 multi th($x where { $x % 10 == 3 }) { {$x}rd }
 multi th($x) { {$x}th }

 say th(22)

 but it yields 22th.  Is this a Rakudo bug or me not understanding
 how constraints work?

 --
 Mark J. Reed markjr...@gmail.com




-- 
Mark J. Reed markjr...@gmail.com


Re: Multi constraints and specificity

2008-12-24 Thread Larry Wall
On Wed, Dec 24, 2008 at 06:57:39PM -0500, Mark J. Reed wrote:
: Ok, it works with a $^var in place of $x in the where block.Should
: the parameter be visible there under its declared name?  If not, then
: this is clearly just pilot error, and never mind...

It's supposed to be visible by then, so I'd say it's a buglet.

Larry


[perl #61644] Range.reverse returns a Str

2008-12-24 Thread Carl Mäsak
# New Ticket Created by  Carl Mäsak 
# Please include the string:  [perl #61644]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61644 


masak rakudo: say (1..8).reverse.WHAT
p6eval rakudo 34331: OUTPUT«Str␤»
* masak submits rakudobug


[perl #61654] Where-clauses only work correctly with blocks -- not smartmatch

2008-12-24 Thread David Whipp
# New Ticket Created by  David Whipp 
# Please include the string:  [perl #61654]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61654 


(rakudo 34337)

Examples:

sub foo( $x where { $_ eq x } ) { say X }
x(x)

works, but

  sub foo( $x where x ) { say X }
  sub foo( $x where /x/ ) { say X }
  sub foo( $x where {/x/} ) { say X }
  sub foo( where {/x/} $x ) { say X }

all fail with various error messages. (the last two are SEGV errors)


---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


[perl #61662] implicit binding of matches to $_

2008-12-24 Thread David Whipp
# New Ticket Created by  David Whipp 
# Please include the string:  [perl #61662]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61662 


(rakudo 34337)

 $_ = a; say /a/ ?? yes !! no
yes
 $_ = a; say /b/ ?? yes !! no
Yes --- WRONG!
 $_ = a; say $_ ~~ /a/ ?? yes !! no
yes
 $_ = a; say $_ ~~ /b/ ?? yes !! no
No --- CORRECT



---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


[perl #61658] X operator behaves like comma

2008-12-24 Thread David Whipp
# New Ticket Created by  David Whipp 
# Please include the string:  [perl #61658]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61658 


(rakudo 34337)

./perl6 -e 'say (2 X 3).perl'
[2, 3]

I expected a list of 3 elements (2 repeated 3 times), not a list of the args 
to the operator


---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


[perl #61656] my declaration at start of block following sub decl that doesn't end with semicolon

2008-12-24 Thread David Whipp
# New Ticket Created by  David Whipp 
# Please include the string:  [perl #61656]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61656 


(rakudo 34337)

Strange parsing error:

sub x {
}
while 0 {
my $b = 1;
}

breaks: [[[ Statement not terminated properly at line 6, near {\n
my $   ]]]

If I add a semicolon after to sub decl, then it's happy:

sub x {
};  ## --- semicolon here!
while 0 {
my $b = 1;
}

The strange thing is that it's only happening for my decls in the
loop. If I declare the variable earlier, then I can assign it without
problems.



---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


[perl #61676] inequality chaining causes non-intuitive result with junctions

2008-12-24 Thread David Whipp
# New Ticket Created by  David Whipp 
# Please include the string:  [perl #61676]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61676 


Error case:

say improper collapse if 10  (5|25)  20;

-- rakudo 34339: OUTPUT«improper collapse␤»

The conditional evaluates to true (and thus prints the message)! For a chained 
inequality term, such as this, I would expect transitive behavior to hold for a 
junction’s values.

I also noted that there’s a SEGV if I replace Csay with Cdie.


---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


12 hackers hacking...

2008-12-24 Thread Mark J. Reed
Inspired by a message over on the Applescript users list, I thought
I'd try to whip up a silly little P6 script to print out the 12 days
of Christmas.  I tried to use as many P6isms as I could squeeze in,
but wanted it to work in Rakudo, which doesn't yet parse closure
traits or multimethods, so had to scale back some.

What's the consensus on how to do an idiomatic countdown loop?  I used
for [1..$n].reverse...

I also tried this, but it caused Rakudo to throw a StopIteration and
then segfault:

for [...@gifts[0..$day-1]].pairs.reverse - $n, $g

Anyway, here's my take:

#!./perl6
my @gifts = ('partridge in a pear tree', 'turtle doves', 'French hens',
 'calling birds', 'gold rings', 'geese a-laying',
 'swans a-swimming', 'maids a-milking', 'ladies dancing',
 'lords a-leaping', 'pipers piping', 'drummers drumming');

for (1..12) - $day
{
say On the {nth($day)} day of Christmas, my true love gave to me:;
for [0..$day-1].reverse - $n
{
my $g = @gifts[$n];
print \t;
say $n ?? sprintf '%2d %s%s', $n+1, $g, ($day  2 ?? ',' !! '')
   !! {$day  1 ?? ' and' !! ''} a $g.;
}
}

multi nth($x where { $^x % 10 == 1  $^x % 100 != 11} ) { {$x}st };
multi nth($x where { $^x % 10 == 2  $^x % 100 != 12} ) { {$x}nd };
multi nth($x where { $^x % 10 == 3  $^x % 100 != 13} ) { {$x}rd };
multi nth($x) { {$x}th };

And as it's just past midnight here in US/Eastern, Merry Christmas to
those who celebrate it!

-- 
Mark J. Reed markjr...@gmail.com


[perl #61670] list quotes don't return list for 1-elem

2008-12-24 Thread David Whipp
# New Ticket Created by  David Whipp 
# Please include the string:  [perl #61670]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61670 


Demonstrated by this test:

dwhip rakudo: .say for A B.map: { [ .split() ] }
p6evalirc://freenode/p6eval,isnick rakudo 34338: OUTPUT«A␤B␤»
dwhipp rakudo: .say for A.map: { [ .split() ] }
p6evalirc://freenode/p6eval,isnick rakudo 34338: OUTPUT«Method 'iterator' 
not found for invocant of class 'Str'␤current instr.: 'parrot;Any;map' pc 9625 
(src/builtins/any-list.pir:228)␤»


---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---


[perl #61658] X operator behaves like comma

2008-12-24 Thread Stephen Weeks via RT
This isn't a bug.  That's the correct behavior for the capital X
operator, also called the cross operator.  S03 defines it as:

the X operator returns all possible lists formed by taking one element
from each of its list arguments

Perl 5's lowercase x operator has split into Perl 6's x and xx, which
are 'string replication' and 'list replication'.

[swe...@kweh ~]$ rakudo
 say (2 x 3).perl
222
 say (2 xx 3).perl
[2, 2, 2]


[perl #61672] .map method (also grep) doesn't allow pointy-blocks

2008-12-24 Thread David Whipp
# New Ticket Created by  David Whipp 
# Please include the string:  [perl #61672]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61672 


% ./perl6 -e '.say for a 1 b 2.map: { $^a ~ $^b }'
a1
b2

% ./perl6 -e '.say for a 1 b 2.map: - $a, $b { $a ~ $b }'
Statement not terminated properly at line 1, near : - $a, $



---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---