Re: [perl #58626] default and when * execute even when another when clause is used

2008-09-06 Thread Stephen Simmons

On Sep 6, 2008, at 10:51 AM, Larry Wall wrote:


On Sat, Sep 06, 2008 at 11:38:42AM -0500, John M. Dlugosz wrote:
The when statements are just like if statements.  After executing  
one,

it goes on to the following statement which does not have to be a
conditional statement.  That is, you can mix when statements with  
plain

unconditional statements.

If multiple when conditions match, it runs all of them.  It's more  
like

if statements, not like a C switch statement.


No, when statements also imply a break at the end of the block.  It
should never run more than one (unless you explicitly say "continue").
You can mix unconditional statements, but any after the first matching
when will not be run (unless you say "continue").

If both "when *" and "default" are running, it's a small bug,
indicating that the "when * {...}" got turned into a mere "{...}"
or "..." on the assumption that you don't actually have to test for
the default condition.  Which you don't, but it should still run
only one default block, so it should really turn into something like
"{...; break}".


I've set up two identical when blocks, followed by a when * and a  
default and all of them run, which is consistent with the behavior  
that John describes.  The current behavior is no different from a if  
EXPR block which is shorter to type, so I'm glad that the intended  
behavior is to break out on success.


Patrick merged this with #57652, and there is a comment in the code  
that marks this behavioral problem as a todo (in src/parser/actions.pm).


Stephen Simmons




Larry





capitalization of classes

2008-09-03 Thread Stephen Simmons
While S02 reserves some all caps names, I assume that all lower case class
names are okay (I don't see anything against them).  Rakudo doesn't support
them.  Is this a bug or is there something in the synopsis that I've missed.

Here is my example:

class Test { has $.x; }
class test { has $.x; }

Test.new(:x<3>);
test.new(:x<3>);

It produces:

sully:perl6 stephensimmons$ perl6 experiment/class_capitalization.p6
invoke() not implemented in class 'test'
current instr.: '_block11' pc 42 (EVAL_13:18)
called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806
(src/PCT/HLLCompiler.pir:481)
called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1078
(src/PCT/HLLCompiler.pir:610)
called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1257
(src/PCT/HLLCompiler.pir:699)
called from Sub 'parrot;Perl6::Compiler;main' pc 15522 (perl6.pir:172)

Stephen Simmons


Regex repetition controlled by characters

2008-08-31 Thread Stephen Simmons
In S05, I found this regarding the generalized repetition specifier:

 ** '|'# repetition controlled by presence of character

I tried it out with

rule thislist {  ** '|' };

and got (with Rakudo):

perl6regex parse error: Error in closure quantifier at offset 28, found '''

Is this feature unsupported at the moment or am I misunderstanding it?

Stephen Simmons