This week's Perl Summary

2003-01-02 Thread Piers Cawley
The Perl 6 Summary for the week ending 20021229
This is not your normal summary. It's been Christmas, things have been
quiet, I've been concentrating on mince pies, roast goose and all that
other good stuff. Normal service will be resumed next week.

Acknowledgements
*   Larry Wall is just wonderful. Thanks for you ongoing design work and
for your injections of clarity into the mailing lists. Not that I
want to nag or anything, but could we have a few more apocalypses
this year?

*   Damian Conway is madder than a treeful of very mad fish, but in a
good way. Thanks for your patience and continuing effort -- it's
always a pleasure to read your posts, especially the ones where you
implement Hard Stuff in about 10 lines of lucid Perl 6.

*   Dan Sugalski is a virtual machine designer of taste and
descrimination. Thanks for Parrot, it's grrreat.

*   Leopold Tötsch is the Patch Monster! Thanks for your staggering
Parrot patch output.

*   Leon Brocard is not just a running joke. But thanks for making
it easy to keep the joke running.

*   Everyone who answered the questionnaire at any time, thanks.

*   Thanks to everyone who has given me feedback as a result of these
summaries. It's really good to know that people finding these things
useful.

*   Everyone who has donated to the Perl Foundation (at
), whether in response to these
summaries or not.

*   Gill Cawley, for obvious reasons.

I've missed out a pile of people I know, but you're either partial or
you end up doing a massively long, bad Oscar acceptance speech kind of
list.

Have a great 2003 folks.




PRE / POST in loops

2003-01-02 Thread Arthur Bergman
Hello,

I just got a question from Lee Pumphret regarding Hook::Scope POST in 
loops.

Currently it treats every iteration as a scope entry and scope exit so.

for(1..3) {
	POST { print 2 };
	print 1;
}

will print "121212",

Since perl6 seems to have a NEXT {} block for doing this, how is POST 
and CATCH supposed to
be used in conjunction with loop scopes.

Arthur



Re: PRE / POST in loops

2003-01-02 Thread Luke Palmer
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Date: Thu, 2 Jan 2003 19:21:04 +0100
> Cc: [EMAIL PROTECTED]
> From: Arthur Bergman <[EMAIL PROTECTED]>
> X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/
> 
> Hello,
> 
> I just got a question from Lee Pumphret regarding Hook::Scope POST in 
> loops.
> 
> Currently it treats every iteration as a scope entry and scope exit so.
> 
> for(1..3) {
>   POST { print 2 };
>   print 1;
> }
> 
> will print "121212",
> 
> Since perl6 seems to have a NEXT {} block for doing this, how is POST 
> and CATCH supposed to
> be used in conjunction with loop scopes.

The difference between POST and NEXT is simply that POST fails to
refrain from executing after the final iteration, while NEXT does not.

You example is correct.  In addition,

for 1..3 {
  print 1;
  NEXT { print 2 }
}

Prints "12121".

NEXT is really a kind of PRE block, contrary to what the example may
lead you to believe.  So, 

for 1..3 {
  print;
  NEXT { print }
}

Prints "12233", not "11223".

As I recall, CATCH can be used inside any block that contains an
expression that may throw an exception.

for 1..Inf {
die "Bonkers";
CATCH {
  print;
}
}

Prints "Bonkers".

I hope this clarified things.

Luke