<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<feed xmlns="http://www.w3.org/2005/Atom">

	<title>Planet Perl Six</title>
	<link rel="self" href="http://planetsix.perlfoundation.org/atom.xml"/>
	<link href="http://planetsix.perlfoundation.org"/>
	<id>http://planetsix.perlfoundation.org/atom.xml</id>
	<updated>2012-05-16T16:22:57+00:00</updated>
	<generator uri="http://www.planetplanet.org/">http://intertwingly.net/code/venus/</generator>

	<entry>
		<title type="html">t4: Hex puzzle</title>
		<link href="http://strangelyconsistent.org/blog/t4-hex-puzzle"/>
		<id>tag:strangelyconsistent.org,2012-05-16:blog/t4-hex-puzzle</id>
		<updated>2012-05-16T16:05:28+00:00</updated>
		<content type="html">&lt;p&gt;Despite a rather long absence from such matters, we haven't forgotten that
we're still in the midst of reviewing &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;Perl 6 Coding Contest
2011&lt;/a&gt; code
submissions. The t4 task was of the puzzle kind. See the post about &lt;a href=&quot;http://strangelyconsistent.org/blog/counting-t4-configurations&quot;&gt;counting
t4 configurations&lt;/a&gt;
for some overview of the static parts of the problem.&lt;/p&gt;

&lt;p&gt;In this post, it's time to get dynamic and look at how to solve actual hex
puzzles. The rest of the problem went like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;A valid playing move on this board consists of sliding a piece along
its groove, either forwards or backwards. There are a few things which
are *not* allowed:

* Two pieces may never overlap and occupy the same location. (Note that
  the above three representations of the board actually denote the same
  board; the three sets of grooves intersect each other.)

* A piece may not &quot;push&quot; another piece as it slides; it is simply locked
  in by that other piece.

* A piece may not &quot;jump&quot; over another piece as it slides; it is restricted
  in its movement by the current positions of the other pieces.

* A piece may not rotate, move sideways, or otherwise leave its groove.

It's perfectly valid for a groove to contain more than one piece (as
long as they don't overlap).

For this problem, we will restrict ourselves to initial board configurations
with a piece at l1 and l2 (written as &quot;l12&quot;). We call this piece the &quot;bullet&quot;.
The goal is to slide the bullet to l56, through a valid sequence of moves.
Thus, other pieces may have to be moved in order to get the bullet to l56.

                ..  ..  ..  ..  ..
              ..  ..  ..  ..  ..  ..
                ..  ..  ..  ..  ..
    start --&amp;gt; l1  l2  ..  ..  l5  l6 &amp;lt;-- goal
                ..  ..  ..  ..  ..
              ..  ..  ..  ..  ..  ..
                ..  ..  ..  ..  ..

Some initial configurations won't have a solution at all. (For example, the
bullet will never get through if there are other pieces in its groove.)

Write a program that accepts an initial board configuration on standard input.
The format looks as follows:

    d67
    i12
    l12
    u345
    v34

The program should reject any initial board configuration that has illegal
piece specifications, contains overlapping pieces, or lacks the bullet at
l12.

If there is possible solution, the program should output

    No solution.

Otherwise it should output one solution as a sequence of valid moves on
this format:

    u[345 -&amp;gt; 456]
    d[67 -&amp;gt; 23]
    u[456 -&amp;gt; 123]
    v[34 -&amp;gt; 23]
    l[12 -&amp;gt; 56]

A solution doesn't have to be minimal in the number of moves, but it may
count in your favor if it is. Even more so if it's minimal in the total
distance the pieces were moved. Arriving at a solution quickly is an
even more important success metric than minimal solutions.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I strongly encourage you to try a few problems; they're often quite exquisite.
Each puzzle instance requires you to move the bullet from one side of the board
to the other, but in order to do so, you must move aside other pieces, and in
order to do &lt;em&gt;that&lt;/em&gt;, you must move yet other pieces. Everyone who has ever tried
their hand at &lt;a href=&quot;http://en.wikipedia.org/wiki/Sokoban&quot;&gt;Sokoban&lt;/a&gt; knows that this
quickly grows non-trivial. (The problem of solving Sokoban puzzles has been
proven to be NP-hard. I know of no such result for this hex puzzle, but let's
just say it wouldn't surprise me.)&lt;/p&gt;

&lt;p&gt;The necessity of moving pieces aside forms an implicit dependency tree. If that
were all, these puzzles would be merely mechanical and boring. But what often
happens is that &lt;em&gt;the dependencies are not cleanly separated&lt;/em&gt;, and you have the
additional problem of not tripping over your own pieces. Here's an example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  ..  q4  ..  ..  t7
..  q3  j3  j4  t6  ..
  q2  e3  k3  k4  ..
l1  l2  e4  ..  c4  ..
  m1  m2  ..  d5  c5
..  ..  n3  n4  d6  c6
  ..  o2  o3  o4  ..
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We trivially notice that in order to get the bullet (the &lt;code&gt;l&lt;/code&gt; piece) across, we
need to move aside the &lt;code&gt;e&lt;/code&gt; piece and the &lt;code&gt;c&lt;/code&gt; piece. But in the starting
configuration, both of these pieces are blocked by other pieces. So we must move
them first. And so on.&lt;/p&gt;

&lt;p&gt;Reasoning about this kind of board takes place in a backwards manner. We figure
out which pieces we have to move out of the way to be able to move the pieces we
are really interested in. We follow the dependencies backwards until we bottom
out.&lt;/p&gt;

&lt;p&gt;In this particular problem, it's a bit worse than that: the two subproblems of
&quot;move aside the &lt;code&gt;e&lt;/code&gt; piece&quot; and &quot;move aside the &lt;code&gt;c&lt;/code&gt; piece&quot; interact. Why?
Because the &lt;code&gt;c&lt;/code&gt; piece is blocked by the &lt;code&gt;k&lt;/code&gt; piece, which is blocked by the &lt;code&gt;e&lt;/code&gt;
piece. So we can't just solve the subproblems in any order we like, we have to
find a way to solve them that works.  The whole thing has a feel of people
attempting to execute a ballet number in a crowded elevator. It's exquisite.
It's frustrating.&lt;/p&gt;

&lt;p&gt;So, people solve this problem by reasoning backwards. This is the only working
approach I've seen, and I've talked to quite a few people about this problem.
How should a machine solve it?&lt;/p&gt;

&lt;p&gt;Well, there's always the brute force approach. Try all possible moves from the
starting configuration, and all moves from the configurations that result, and
so on until you either (a) run out of new configurations to try, or (b) solve
the problem. If you do this in a breadth-first way, i.e. you examine the new
configurations in a first-in-first-out manner, you're also guaranteed to find
a shortest possible solution first. (Shortest in terms of moves required.)&lt;/p&gt;

&lt;p&gt;This is fine. It's slow, but it's fine. What some of our contestants ended up
doing was to improve on this by using &lt;a href=&quot;http://en.wikipedia.org/wiki/A*_search_algorithm&quot;&gt;A*
search&lt;/a&gt; to guide the search.
A perfect fit, it seems, for this kind of problem. The extra complexity from
upgrading from BFS to A* is paid back in spades by the problems being solved
faster. A success story.&lt;/p&gt;

&lt;p&gt;The other possible approach, which none of the submitted entries attempted,
is to do the reasoning about blocking dependencies much in the way humans do.
Though such a solution is certainly possible, I have a creeping suspicion that
it would be far more complex than the A* approach. It's unclear how many
special cases it would need to contain in order to work out all the
dependencies. One gets a bit of extra respect at the pattern-matching and
hypithetical-future algorithms in one's own brain when trying to code up the
same things as a program.&lt;/p&gt;

&lt;p&gt;Be that as it may. &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/&quot;&gt;Have a look at people's
solutions&lt;/a&gt;. Admire people's ingenuity
on this one. Even though virtually everyone solves the problem in the same way,
there's no end to how differently they factor their solutions.&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Parrot 4.4.0 &quot;Banana Fanna Fo Ferret&quot; Released! by Andrew Whitworth</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/05/msg675.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/05/msg675.html</id>
		<updated>2012-05-15T20:25:03+00:00</updated>
		<content type="html">Its existence guarantees nothing in itself, and the catalytic or&lt;br /&gt;    Promethean moment only occurs when one individual is prepared to cease being&lt;br /&gt;    the passive listener to such a voice and to become instead is spokesman, or&lt;br /&gt;    representative.&lt;br /&gt;&lt;br /&gt;    But it's important to remember the many dreary years when the prospect of&lt;br /&gt;    victory appeared quite unattainable. On every day of those years,&lt;br /&gt;the &quot;as if&quot;&lt;br /&gt;    pose had to be kept up, until its cumulative effect could be felt.&lt;br /&gt;    -- Christopher Hitchens, Letters to a Young Contrarian&lt;br /&gt;&lt;br /&gt;On behalf of the Parrot team, I'm proud to announce the 4.4.0 release of&lt;br /&gt;Parrot &quot;Banana Fanna Fo Ferret&quot;.  Parrot (http://parrot.org/) is a virtual&lt;br /&gt;machine aimed at running all dynamic languages.&lt;br /&gt;&lt;br /&gt;Parrot 4.4.0 is available on Parrot's FTP site&lt;br /&gt;(ftp://ftp.parrot.org/pub/parrot/releases/stable/4.4.0/), or by following the&lt;br /&gt;download instructions at http://parrot.org/download.  For those who would like&lt;br /&gt;to develop on Parrot, or help develop Parrot itself, we recommend using Git to&lt;br /&gt;retrieve the source code to get the latest and best Parrot code.&lt;br /&gt;&lt;br /&gt;Parrot 4.4.0 News:&lt;br /&gt;    - Core&lt;br /&gt;        + Most internal calls to libc exit(x) have been replaced with&lt;br /&gt;          Parrot_x_* API calls or PARROT_FORCE_EXIT&lt;br /&gt;    - Documentation&lt;br /&gt;        + 'pdd31_hll.pod' made stable in 'docs/pdds/'.&lt;br /&gt;        + Updated main 'README' to 'README.pod'&lt;br /&gt;        + Updated various dependencies, e.g., 'lib/Parrot/Distribution.pm'.&lt;br /&gt;        + Updated all 'README' files to 'README.pod' files.&lt;br /&gt;        + Added 'README.pod' files to top-level directories.&lt;br /&gt;    - Tests&lt;br /&gt;        + Update various tests to pull from new 'README.pod'&lt;br /&gt;        + Updated 't/tools/install/02-install_files.t' to pull from new&lt;br /&gt;          'README.pod'&lt;br /&gt;    - Community&lt;br /&gt;    - Platforms&lt;br /&gt;    - Tools&lt;br /&gt;        + pbc_merge has been fixed to deduplicate constant strings and&lt;br /&gt;          merge annotations segments&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SHA256 message digests for the downloadable tarballs are:&lt;br /&gt;&lt;br /&gt;348ce13fc136afc74a7b50b094f64d8cb00f83f0cd3d59acc6fa4e63c824fa4d&lt;br /&gt;parrot-4.4.0.tar.bz2&lt;br /&gt;02495c0d11d3977a615bb76d3219f12bc6543b8cf12c596dfd5c35e98d95218a&lt;br /&gt;parrot-4.4.0.tar.gz&lt;br /&gt;&lt;br /&gt;Alvis Yardley (or a delegate) will release Parrot 4.5.0, the next scheduled&lt;br /&gt;monthly release, on June 16th 2012. Subsequent release managers are to be&lt;br /&gt;announced. A special thanks to our donors, contributors and volunteers for&lt;br /&gt;making this release possible.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;br /&gt;--Andrew Whitworth&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">No such pipe, or this pipe has been deleted</title>
		<link href=""/>
		<id>http://pipes.yahoo.com/pipes/c30fa6b5be32693af535b6e46c4fabd6_b3b091b756e161113ae36142ad212cac</id>
		<updated>2012-05-15T19:42:30+00:00</updated>
		<content type="html">This data comes from pipes.yahoo.com but the Pipe does not exist or has been deleted.</content>
		<author>
			<name>Jan Ingvoldstad</name>
			<uri>http://pipes.yahoo.com/pipes/pipe.info?_id=c30fa6b5be32693af535b6e46c4fabd6</uri>
		</author>
		<source>
			<title type="html">Pipes Output</title>
			<subtitle type="html">Pipes Output</subtitle>
			<link rel="self" href="http://pipes.yahoo.com/pipes/pipe.run?_id=c30fa6b5be32693af535b6e46c4fabd6&amp;_render=rss"/>
			<id>http://pipes.yahoo.com/pipes/pipe.info?_id=c30fa6b5be32693af535b6e46c4fabd6</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Since the Hackathon…</title>
		<link href="http://6guts.wordpress.com/2012/05/08/since-the-hackathon/"/>
		<id>http://6guts.wordpress.com/?p=216</id>
		<updated>2012-05-08T22:32:23+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Last time I got around to writing here was while I was at the Oslo Hackathon. It was a truly great event: hugely productive, a great deal of fun and a real motivation booster too. I’d like to again thank Oslo.pm, and especially Salve, Rune and Jan, for thinking to organize this, and then making a superb job of doing so. Everything ran smoothly, there was lots of undistracted hacking time, and a couple of evening dinner and beer outings provided chance to enjoy time together as a team in real life, without the restricted bandwidth IRC normally enforces on us.&lt;/p&gt;
&lt;p&gt;After the hackathon, it was right back to $dayjob, though in a fun way: teaching Git for a couple of days. Less fun was the couple of days after, which involved a lot of pain followed by a lot of noisy drilling at my local dental clinic. It took some days beyond that before I stopped feeling unusually tired… Anyways, things are back to normal again, or as normal as things ever tend to look for me… :-)&lt;/p&gt;
&lt;p&gt;So, what’s been going on in Rakudo land since the hackathon? Lots and lots, as it turns out. Most public-facing, the &lt;a href=&quot;http://rakudo.org/2012/04/26/announce-rakudo-star-2012-04-a-useful-usable-early-adopter-distribution-of-perl-6/&quot;&gt;April 2012 Rakudo Star release&lt;/a&gt; landed; moritz++ is to thank for getting the release out of the door this month. It’s the first distribution release to incorporate the bounded serialization work, which delivers the much-improved startup time. While I’ve talked about many of the compiler side improvements in previous posts, Rakudo Star also includes modules, and we had some exciting additions in this release too: Bailador (a Perl 6 port of Dancer), LWP::Simple and JSON::RPC.&lt;/p&gt;
&lt;p&gt;Of course, one nice release out the door means time to start working on things to make the next one interesting. Here’s some of what to expect.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Following on from removing “lib” from the default @*INC, the current working directory (“.”) is also gone now. While they may be nice for development, they are not good defaults from a security perspective when you actually run stuff in a production environment. Making this a more comfortable removal, as well as supplying search paths through the PERL6LIB environment (as has been supported for a long while), the -I command line option and “use lib” have now been implemented, and will be in the next release. moritz++ is primarily to thank for this work.&lt;/li&gt;
&lt;li&gt;I realized that now we have LEAVE and UNDO phasers, I could implement “temp” and “let”. “temp” saves away the current value of a variable, and arranges for that value to be restored when the block is left, so any changes made to it will be undone. “let” is a way of making hypothetical changes to a variable; if the block is left due to an exception or if it evaluates to an undefined value, the change will be rolled back just like “temp”, but a successful completion of the block will leave the value in place. Both are now in place.&lt;/li&gt;
&lt;li&gt;Several days back, moritz++ asked me for some inspiration of what to hack on. Amongst my suggestions was working on tagged imports/exports. And sure enough, with me throwing the odd commit in now and then, we have ‘em working. Actually the main thing I did was improve the trait handling to support passing the tags to export; some work had been left undone awaiting real serialization, which we now have, so happily it was fairly straightforward to sort things out there.&lt;/li&gt;
&lt;li&gt;pmichaud++ has been working on making things better if you build Parrot and Rakudo without ICU. Previously, any case-insensitive string match – even if it didn’t use anything beyond ASCII – would immediately die over a missing ICU. Now you can get away with that.&lt;/li&gt;
&lt;li&gt;A while back I did a first cut implementation of “ff”, the flip-flop operator. It sorta worked, but we missed the “fff” form and, true to form, masak++ managed to find a bug to submit too. :-) Today I tossed the previous approach and re-did it, using a state variable for the underlying storage (since I did the first cut at it, the spec was updated to explicitly say that it should be done with a state variable). I also got the “fff” form in place. We now pass the vast majority of spectests for this feature.&lt;/li&gt;
&lt;li&gt;A few days back, tadzik++ showed up with a snippet of code that ran insanely slowly. It was doing regex interpolation: / &amp;lt;$search_term&amp;gt; / or the like. Here, if $search_term is a string, it will be compiled to a regex and evaluated. Turns out that we weren’t caching that compilation with the string, though. So, if it had to scan or if you backtracked over the &amp;lt;$search_term&amp;gt;, then tried it again, you’d end up compiling it every time. A little caching later and things went rather faster. I was happy to have a profiler to hand; the call counts into the compiler very quickly showed what was up.&lt;/li&gt;
&lt;li&gt;Our END phasers didn’t always run when you’d hope they did. In the last few days, moritz++ ensured they run on exceptional exits, and I made sure they run when execution is terminated using the “exit” function.&lt;/li&gt;
&lt;li&gt;This evening, kboga++ showed up with a patch to turn Real, which ended up as a class during the early days of the “nom” development branch, into a role as it should be. This enabled custom numeric types. It also enabled us to run real-bridge.t, which brought and extra 200 spectests, pushing us nicely over the 22,000 passing spectests mark.&lt;/li&gt;
&lt;li&gt;In various other fixes: //=, ||= and &amp;amp;&amp;amp;= now short-circuit properly, reduction meta-operators on list-associative ops do the right thing (pmichaud++), %*ENV propagates changes properly (tadzik++), ms// now works (moritz++) and enumeration types can now turn themselves into roles and be composed or mixed in to things.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There’s still over a week before the next compiler release, and I’m sure there will be some more things beyond this. It’s already looking like a nice bunch of improvements, though.&lt;/p&gt;
&lt;p&gt;In other news, the work on QAST has also been chugging along. QAST is a replacement for PAST, which is a set of AST nodes together with something that maps them down to POST (Parrot Opcode Syntax Tree), which then becomes PIR code (which Parrot then turns into bytecode and runs). In essence, it’s part of the compiler guts. The not-quite-gone-yet old regex engine aside, PAST is the only significant part of our codebase that is still written in PIR (an assembly-ish language for Parrot). It also predates 6model, bounded serialization and many years of learned lessons. All that said, it gets a lot right, so much will stay the same.&lt;/p&gt;
&lt;p&gt;QAST really is a simultaneous port to NQP, leaving out things we came to realize were bad or unrequired, adding much better 6model integration, unifying the notion of “ops” somewhat, improving native type support and taking advantage of native types during its implementation to get the AST nodes more compact, so we can save on memory during the compilation. Additionally, it will unblock masak++’s work on quasi splicing in macros, and is a step towards Rakudo targeting other backends being a reality rather than a nice idea. So, lots of win lies ahead…after the hard work of getting it landed. I’m hoping to make some significant steps forward on it during May.&lt;/p&gt;
&lt;p&gt;Last but not least, masak++ and I will be heading over to the &lt;a href=&quot;http://www.itmegameet.co.uk/&quot;&gt;Bristol IT Megameet&lt;/a&gt; the weekend after next, giving a 30 minute joint talk on Perl 6, followed by a couple of hour tutorial. Looking forward to it – and hopefully I’ll be able to sneak a British ale in while I’m over there too. :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/216/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/6guts.wordpress.com/216/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/6guts.wordpress.com/216/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/6guts.wordpress.com/216/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/6guts.wordpress.com/216/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/6guts.wordpress.com/216/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/6guts.wordpress.com/216/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/6guts.wordpress.com/216/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/6guts.wordpress.com/216/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/6guts.wordpress.com/216/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/6guts.wordpress.com/216/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/6guts.wordpress.com/216/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/6guts.wordpress.com/216/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/6guts.wordpress.com/216/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=6guts.wordpress.com&amp;amp;blog=14597269&amp;amp;post=216&amp;amp;subd=6guts&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://6guts.wordpress.com</uri>
		</author>
		<source>
			<title type="html">6guts</title>
			<subtitle type="html">Tales of Perl 6 guts hacking</subtitle>
			<link rel="self" href="http://6guts.wordpress.com/feed/"/>
			<id>http://6guts.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">SQLite support for DBIish</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2012-sqlite-in-dbiish.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2012-sqlite-in-dbiish.html</id>
		<updated>2012-05-03T18:02:47+00:00</updated>
		<content type="html">&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/DBIish/&quot;&gt;DBIish&lt;/a&gt;, the new database
interface for Rakudo Perl 6, now has a working SQLite backend. It uses
prepared statements and placeholders, and supports standard CRUD
operations.&lt;/p&gt;

&lt;p&gt;Previously the SQLite driver would randomly report &quot;Malformed UTF-8 string&quot;
or segfault, but usually worked pretty well when run under valgrind. The
problem turned out to be a mismatch between the caller's and the callee's
ideas about memory management.&lt;/p&gt;

&lt;p&gt;In particular, parrot's garbage collector would deallocate strings passed
to &lt;a href=&quot;http://www.sqlite.org/c3ref/bind_blob.html&quot;&gt;sqlite3_bind_text&lt;/a&gt;
after the call was done, but sqlite wants such values to stay around until
the next call to &lt;a href=&quot;http://www.sqlite.org/c3ref/step.html&quot;&gt;sqlite3_step&lt;/a&gt; in the very
least.&lt;/p&gt;

&lt;p&gt;Fixing this mismatch was enabled &lt;a href=&quot;https://github.com/jnthn/zavolaj/commit/e94f45ca4dd5df3010ecb84051980f506e3cbe6d&quot;&gt;by
this patch&lt;/a&gt;, which lets you mark strings as explicitly managed. Such
strings keep their marshalled C string equivalent around until they are
garbage-collected themselves. So now &lt;a href=&quot;https://github.com/perl6/DBIish/commit/9b339432405228a895c76bf1193bdba3f935b99b&quot;&gt;the
sqlite driver keeps a copy of the strings&lt;/a&gt; as long as necessary, and the SQLite
tests pass reliably.&lt;/p&gt;

&lt;p&gt;Currently it still needs the &lt;code&gt;cstr&lt;/code&gt; branches in the nqp and
zavolaj repositories, but they will be merged soon -- certainly before the May
release of Rakudo.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Announce: Niecza Perl 6 v17 by Carl Mäsak</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/04/msg674.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/04/msg674.html</id>
		<updated>2012-04-30T14:22:40+00:00</updated>
		<content type="html">Announce: Niecza Perl 6 v17&lt;br /&gt;&lt;br /&gt;This is the seventeenth release of Niecza Perl 6, as usual scheduled on&lt;br /&gt;the last Monday of the month.&lt;br /&gt;&lt;br /&gt;You can obtain a build of Niecza from [1].  This build contains a&lt;br /&gt;working compiler as a set of .exe and .dll files suitable for use with&lt;br /&gt;Mono or Microsoft .NET.  If you wish to follow latest developments,&lt;br /&gt;you can obtain the source from [2]; however, you still need a&lt;br /&gt;binary for bootstrapping.&lt;br /&gt;&lt;br /&gt;Niecza is a Perl 6 compiler project studying questions about the&lt;br /&gt;efficient implementability of Perl 6 features.  It currently targets&lt;br /&gt;the Common Language Runtime; both Mono and Microsoft .NET are known to&lt;br /&gt;work.  On Windows, Cygwin is required for source builds only; see the&lt;br /&gt;README for details.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    List of changes&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Minor changes]&lt;br /&gt;&lt;br /&gt;The .Str methods of Set, KeySet, Bag, and KeyBag now just list the elements&lt;br /&gt;(Solomon Foster).&lt;br /&gt;&lt;br /&gt;Out-of-range digits in a radix conversion now warn appropriately (Solomon&lt;br /&gt;Foster).&lt;br /&gt;&lt;br /&gt;The [Z] operator now doesn't hang on empty inputs (Stefan O'Rear).&lt;br /&gt;&lt;br /&gt;Cool.eval added (Solomon Foster).&lt;br /&gt;&lt;br /&gt;[Major changes]&lt;br /&gt;&lt;br /&gt;List comprehension syntax like ($_*$_ for 0..9) works now (Stefan O'Rear).&lt;br /&gt;&lt;br /&gt;'no strict' (Stefan O'Rear).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Getting involved&lt;br /&gt;&lt;br /&gt;Contact sorear in irc.freenode.net #perl6 or via the stefanor@cox.net.&lt;br /&gt;Also check out the TODO file; whether you want to work&lt;br /&gt;on stuff on it, or have cool ideas to add to it, both are good.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[1] https://github.com/downloads/sorear/niecza/niecza-17.zip&lt;br /&gt;[2] https://github.com/sorear/niecza&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Meet DBIish, a Perl 6 Database Interface</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2012-dbiish.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2012-dbiish.html</id>
		<updated>2012-04-28T19:03:10+00:00</updated>
		<content type="html">&lt;p&gt;In the aftermath of the Oslo Perl 6 hackathon 2012, I have decided to fork
and rename MiniDBI. MiniDBI is intended as a compatible port of Perl 5's
excellent DBI module to Perl 6. While working on the MiniDBI backends, I
noticed that I became more and more unhappy with that. Perl 6 is sufficiently
different from Perl 5 to warrant different design decisions in the database
interface layer.&lt;/p&gt;

&lt;p&gt;Meet &lt;a href=&quot;https://github.com/perl6/DBIish/&quot;&gt;DBIish&lt;/a&gt;. It started with
MiniDBI's code base, but has some substantial deviations from MiniDBI:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Connection information is passed by named arguments to the driver
    (instead of a single DSN string)&lt;/li&gt;
    &lt;li&gt;Different naming of several methods. There's not much point in having
    both &lt;code&gt;fetchrow_array&lt;/code&gt; and &lt;code&gt;fetchrow_arrayref&lt;/code&gt; in
    Rakudo. &lt;code&gt;fetchrow&lt;/code&gt; simply returns an array or a list, and the
    caller decides what to do with it.&lt;/li&gt;
    &lt;li&gt;Backends only need to implement &lt;code&gt;fetchrow&lt;/code&gt; and
    &lt;code&gt;column_names&lt;/code&gt;, and get all the other fetching methods (like
    &lt;code&gt;fetchrow-hash&lt;/code&gt;, &lt;code&gt;fetchall-hash&lt;/code&gt;) for free.&lt;/li&gt;
    &lt;li&gt;Error handling from DB connection and statement handle are unified
    into a single row&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The latter two changes brought quite a reduction in backend code size.&lt;/p&gt;

&lt;p&gt;My plans for the future include experimenting with different names and
maybe totally different APIs. When a language has lazy lists, one can simply
return all rows lazily, instead of encouraging the user to fetch the rows one
by one.&lt;/p&gt;

&lt;p&gt;Currently the Postgresql and mysql backends support basic CRUD operations,
Postgresql with proper prepared statements and placeholders. An SQLite backend
is under way, but still needs better support from our native call interface.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Announce: Rakudo Star 2012.04 – a useful, usable, “early adopter” distribution of Perl 6</title>
		<link href="http://rakudo.org/2012/04/26/announce-rakudo-star-2012-04-a-useful-usable-early-adopter-distribution-of-perl-6/"/>
		<id>http://rakudo.org/?p=130</id>
		<updated>2012-04-26T14:19:13+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;On behalf of the Rakudo and Perl 6 development teams, I’m happy to&lt;br /&gt;
announce the April 2012 release of “Rakudo Star”, a useful and&lt;br /&gt;
usable distribution of Perl 6. The tarball for the April 2012&lt;br /&gt;
release is available from &lt;a href=&quot;https://github.com/rakudo/star/downloads&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In the Perl 6 world, we make a distinction between the language&lt;br /&gt;
(“Perl 6″) and specific implementations of the language such as&lt;br /&gt;
“Rakudo Perl”. This Star release includes release 2012.04.1 [0] of the&lt;br /&gt;
Rakudo Perl 6 compiler [1], version 4.3 of the Parrot Virtual&lt;br /&gt;
Machine [2], and various modules, documentation, and other&lt;br /&gt;
resources collected from the Perl 6 community.&lt;/p&gt;
&lt;p&gt;Here are some of the major improvements in this release over the&lt;br /&gt;
previous distribution release.&lt;/p&gt;
&lt;p&gt;* much improved startup time&lt;/p&gt;
&lt;p&gt;* much more robust module precompilation&lt;/p&gt;
&lt;p&gt;* autovivification for arrays and hashes is implemented again&lt;/p&gt;
&lt;p&gt;* many phasers like PRE, POST and REDO are now implemented&lt;/p&gt;
&lt;p&gt;* improved support for calling C functions and modelling structs and arrays&lt;br /&gt;
via NativeCall.pm6&lt;/p&gt;
&lt;p&gt;* now includes modules URI, LWP::Simple, jsonrpc and Bailador (a Perl 6 port&lt;br /&gt;
of Dancer)&lt;/p&gt;
&lt;p&gt;This release also contains a range of bug fixes, improvements to error&lt;br /&gt;
reporting and better failure modes. Many more exceptions are thrown&lt;br /&gt;
as typed exceptions.&lt;/p&gt;
&lt;p&gt;Some notable incompatible changes from the previous release include&lt;/p&gt;
&lt;p&gt;* the ‘lib’ directory is not included in the default module search path&lt;br /&gt;
anymore. You can manipulate the search path with the PERL6LIB environment&lt;br /&gt;
variable&lt;/p&gt;
&lt;p&gt;* ‘defined’ used to be a prefix operator, and is now a regular subroutine.&lt;br /&gt;
This means you must updated code that relies ‘defined’ taking only one&lt;br /&gt;
argument. For example ‘defined $x ?? $a !! $b’ should be written as&lt;br /&gt;
‘$x.defined ?? $a !! $b’ or ‘defined($x) ?? $a !! $b’.&lt;/p&gt;
&lt;p&gt;There are some key features of Perl 6 that Rakudo Star does not&lt;br /&gt;
yet handle appropriately, although they will appear in upcoming&lt;br /&gt;
releases. Some of the not-quite-there features include:&lt;br /&gt;
* pack and unpack&lt;br /&gt;
* macros&lt;br /&gt;
* threads and concurrency&lt;br /&gt;
* Unicode strings at levels other than codepoints&lt;br /&gt;
* interactive readline that understands Unicode&lt;br /&gt;
* non-blocking I/O&lt;br /&gt;
* much of Synopsis 9&lt;/p&gt;
&lt;p&gt;There is a new online resource at http://perl6.org/compilers/features&lt;br /&gt;
that lists the known implemented and missing features of Rakudo Star&lt;br /&gt;
2012.04 and other Perl 6 implementations.&lt;/p&gt;
&lt;p&gt;In many places we’ve tried to make Rakudo smart enough to inform the&lt;br /&gt;
programmer that a given feature isn’t implemented, but there are&lt;br /&gt;
many that we’ve missed. Bug reports about missing and broken&lt;br /&gt;
features are welcomed at.&lt;/p&gt;
&lt;p&gt;See http://perl6.org/ for links to much more information about&lt;br /&gt;
Perl 6, including documentation, example code, tutorials, reference&lt;br /&gt;
materials, specification documents, and other supporting resources.&lt;br /&gt;
An updated draft of a Perl 6 book is available as&lt;br /&gt;
in the release tarball.&lt;/p&gt;
&lt;p&gt;The development team thanks all of the contributors and sponsors&lt;br /&gt;
for making Rakudo Star possible. If you would like to contribute,&lt;br /&gt;
see , ask on the perl6-compiler@perl.org&lt;br /&gt;
mailing list, or join us on IRC #perl6 on freenode.&lt;/p&gt;
&lt;p&gt;[0] https://github.com/rakudo/rakudo/blob/nom/docs/announce/2012.04.1&lt;br /&gt;
[1] http://github.com/rakudo/rakudo&lt;br /&gt;
[2] http://parrot.org/&lt;/p&gt;</content>
		<author>
			<name>moritz</name>
			<uri>http://rakudo.org</uri>
		</author>
		<source>
			<title type="html">rakudo.org</title>
			<subtitle type="html">Rakudo Perl 6</subtitle>
			<link rel="self" href="http://rakudo.org/feed/"/>
			<id>http://rakudo.org</id>
		</source>
	</entry>

	<entry>
		<title type="html">Announce: Rakudo Star 2012.04 - a useful, usable, &quot;early adopter&quot;distribution of Perl 6 by Moritz Lenz</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/04/msg673.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/04/msg673.html</id>
		<updated>2012-04-26T09:59:03+00:00</updated>
		<content type="html">On behalf of the Rakudo and Perl 6 development teams, I'm happy to&lt;br /&gt;announce the February 2012 release of &quot;Rakudo Star&quot;, a useful and&lt;br /&gt;usable distribution of Perl 6.  The tarball for the February 2012&lt;br /&gt;release is available from &amp;lt;http://github.com/rakudo/star/downloads&amp;gt;.&lt;br /&gt;&lt;br /&gt;In the Perl 6 world, we make a distinction between the language&lt;br /&gt;(&quot;Perl 6&quot;) and specific implementations of the language such as&lt;br /&gt;&quot;Rakudo Perl&quot;.  This Star release includes release 2012.04.1 [0] of the&lt;br /&gt;Rakudo Perl 6 compiler [1], version 4.3 of the Parrot Virtual&lt;br /&gt;Machine [2], and various modules, documentation, and other&lt;br /&gt;resources collected from the Perl 6 community.&lt;br /&gt;&lt;br /&gt;Here are some of the major improvements in this release over the&lt;br /&gt;previous distribution release.&lt;br /&gt;&lt;br /&gt;* much improved startup time&lt;br /&gt;&lt;br /&gt;* much more robust module precompilation&lt;br /&gt;&lt;br /&gt;* autovivification for arrays and hashes is implemented again&lt;br /&gt;&lt;br /&gt;* many phasers like PRE, POST and REDO are now implemented&lt;br /&gt;&lt;br /&gt;* improved support for calling C functions and modelling structs and &lt;br /&gt;arraysvia NativeCall.pm6&lt;br /&gt;&lt;br /&gt;* now includes modules URI, LWP::Simple, jsonrpc and Bailador (a Perl 6 &lt;br /&gt;port of Dancer)&lt;br /&gt;&lt;br /&gt;This release also contains a range of bug fixes, improvements to error&lt;br /&gt;reporting and better failure modes. Many more exceptions are thrown&lt;br /&gt;as typed exceptions.&lt;br /&gt;&lt;br /&gt;Some notable incompatible changes from the previous release include&lt;br /&gt;&lt;br /&gt;  * the 'lib' directory is not included in the default module search &lt;br /&gt;path anymore.  You can manipulate the search path with the PERL6LIB &lt;br /&gt;environment variable&lt;br /&gt;&lt;br /&gt;  * 'defined' used to be a prefix operator, and is now a regular &lt;br /&gt;subroutine. This means you must updated code that relies 'defined' &lt;br /&gt;taking only one argument. For example 'defined $x ?? $a !! $b' should be &lt;br /&gt;written as '$x.defined ?? $a !! $b' or 'defined($x) ?? $a !! $b'.&lt;br /&gt;&lt;br /&gt;There are some key features of Perl 6 that Rakudo Star does not&lt;br /&gt;yet handle appropriately, although they will appear in upcoming&lt;br /&gt;releases.  Some of the not-quite-there features include:&lt;br /&gt;   * pack and unpack&lt;br /&gt;   * macros&lt;br /&gt;   * threads and concurrency&lt;br /&gt;   * Unicode strings at levels other than codepoints&lt;br /&gt;   * interactive readline that understands Unicode&lt;br /&gt;   * non-blocking I/O&lt;br /&gt;   * much of Synopsis 9&lt;br /&gt;&lt;br /&gt;There is a new online resource at http://perl6.org/compilers/features&lt;br /&gt;that lists the known implemented and missing features of Rakudo Star&lt;br /&gt;2012.04 and other Perl 6 implementations.&lt;br /&gt;&lt;br /&gt;In many places we've tried to make Rakudo smart enough to inform the&lt;br /&gt;programmer that a given feature isn't implemented, but there are&lt;br /&gt;many that we've missed.  Bug reports about missing and broken&lt;br /&gt;features are welcomed at &amp;lt;rakudobug@perl.org&amp;gt;.&lt;br /&gt;&lt;br /&gt;See http://perl6.org/ for links to much more information about&lt;br /&gt;Perl 6, including documentation, example code, tutorials, reference&lt;br /&gt;materials, specification documents, and other supporting resources.&lt;br /&gt;An updated draft of a Perl 6 book is available as&lt;br /&gt;&amp;lt;docs/UsingPerl6-draft.pdf&amp;gt; in the release tarball.&lt;br /&gt;&lt;br /&gt;The development team thanks all of the contributors and sponsors&lt;br /&gt;for making Rakudo Star possible.  If you would like to contribute,&lt;br /&gt;see &amp;lt;http://rakudo.org/how-to-help&amp;gt;, ask on the perl6-compiler@perl.org&lt;br /&gt;mailing list, or join us on IRC #perl6 on freenode.&lt;br /&gt;&lt;br /&gt;[0] https://github.com/rakudo/rakudo/blob/nom/docs/announce/2012.04.1&lt;br /&gt;[1] http://github.com/rakudo/rakudo&lt;br /&gt;[2] http://parrot.org/&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Post-hackathon thoughts</title>
		<link href="http://howcaniexplainthis.blogspot.com/2012/04/post-hackathon-thoughts.html"/>
		<id>tag:blogger.com,1999:blog-753668960778118906.post-1158293179092473124</id>
		<updated>2012-04-25T11:15:00+00:00</updated>
		<content type="html">It has been a few days, and we have (sort of) landed.&lt;br /&gt;&lt;br /&gt;I shall call this year's Oslo.pm Perl 6 Patterns hackathon a success, judging by how the participants seemed to enjoy themselves during the hackathon, and the &lt;a href=&quot;http://planetsix.perl.org/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;inspired blogging&lt;/a&gt; afterwards.&lt;br /&gt;&lt;br /&gt;Salve (sjn) and Rune (krunen) have, on behalf of Oslo.pm, delivered to standards that I am a bit worried that guests now will come to expect ;), and although I did not have capacity to help with much, I am happy with how everything turned out, except for one thing:&lt;br /&gt;&lt;br /&gt;Damian caught a cold, and was essentially out of the loop for most of the hackathon.&lt;br /&gt;&lt;br /&gt;Darnit.&lt;br /&gt;&lt;br /&gt;But he delivered a kick-ass talk on Thursday, and was very helpful and a very good resource before he somewhat reluctantly accepted the thrown towel.&lt;br /&gt;&lt;br /&gt;I did not do much hacking this year myself, but I managed to revive some of my Perl 6 skills.  I even fiddled a bit with the cookbook (dormant for three years or so, and therefore slightly out-of-date in some respects). I hope to contribute more to that piece of documentation in the coming months.&lt;br /&gt;&lt;br /&gt;The bonus if I manage to work my way through it, is that I will be pretty much up to speed with the language. Win!&lt;br /&gt;&lt;br /&gt;My thanks go to all the participants of the Hackathon, without you, Perl 6 would be much the poorer!&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/753668960778118906-1158293179092473124?l=howcaniexplainthis.blogspot.com&quot; width=&quot;1&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>bakkushan</name>
			<uri>http://pipes.yahoo.com/pipes/pipe.info?_id=c30fa6b5be32693af535b6e46c4fabd6</uri>
		</author>
		<source>
			<title type="html">How Can I Explain This? - Perl 6</title>
			<subtitle type="html">Pipes Output</subtitle>
			<link rel="self" href="http://pipes.yahoo.com/pipes/pipe.run?_id=c30fa6b5be32693af535b6e46c4fabd6&amp;_render=rss"/>
			<id>http://pipes.yahoo.com/pipes/pipe.info?_id=c30fa6b5be32693af535b6e46c4fabd6</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en-US">開源之道</title>
		<link href="http://pugs.blogs.com/pugs/2012/04/%E9%96%8B%E6%BA%90%E4%B9%8B%E9%81%93.html"/>
		<id>http://pugs.blogs.com/pugs/2012/04/%E9%96%8B%E6%BA%90%E4%B9%8B%E9%81%93.html</id>
		<updated>2012-04-24T12:40:05+00:00</updated>
		<content type="html" xml:lang="en-US">&lt;p&gt;&lt;em&gt;(這是 Allison Randal 在 OSDC.tw 的演講中譯本。請參&lt;em&gt;&lt;em&gt;見&lt;/em&gt;&lt;/em&gt;&lt;a href=&quot;http://allisonrandal.com/2012/04/15/open-source-enlightenment/&quot; target=&quot;_blank&quot; title=&quot;Open Source Enlightenment&quot;&gt;原文&lt;/a&gt;及&lt;a href=&quot;https://www.youtube.com/watch?v=E5_tL62mUbc&quot; target=&quot;_blank&quot;&gt;錄影&lt;/a&gt;。)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;這幾年來，我慢慢覺得，我們參與開源社群，就像是在一條道路上並肩而行：這不僅讓我們成為更好的程式設計者，也讓我們通過與人合作，而成為更好的人。&lt;/p&gt;
&lt;p&gt;您可以將它想成一條修行之道，讓身而為人的我們能夠不斷成長。接下來，我想談談我對開源世界的個人觀點，希望能與您分享。&lt;/p&gt;
&lt;p&gt;首先，人是一切開源專案的核心。程式碼是很重要，但最核心的永遠是人。&lt;/p&gt;
&lt;p&gt;人們透過各種不同的方式來參與專案：有人寫程式，有人寫文件，有人寫測試。而使用軟體的人，同樣也是專案裡不可或缺的一部分。&lt;/p&gt;
&lt;p&gt;您的專案也許會用到別人開發的軟體，而因此接觸到上游的專案，或許偶爾也會向他們提出建議和修正。&lt;/p&gt;
&lt;p&gt;又或許您開發的是一套程式庫或模組，提供給其他專案的人使用。此時，您就是他們的上游專案，他們也會用相同的方式來與您溝通。&lt;/p&gt;
&lt;p&gt;所以，人們到底為什麼要做開源軟體呢？如果您想理解開源模式如何運作，這是一個很關鍵的問題。&lt;/p&gt;
&lt;p&gt;許多人在日常工作中，可能已經常常和軟體打交道了。我們為什麼要花額外的心力，來參與開源專案呢？一部分的原因，是因為這能夠讓人迅速接觸到刺激、有趣的新鮮技術。&lt;/p&gt;
&lt;p&gt;能夠與人分享，也是一個主因：透過與人分享，我們可以認識開源專案裡的同好，來提升彼此的樂趣。&lt;/p&gt;
&lt;p&gt;投入開源專案的人，往往也帶著分享奉獻的精神。能夠伸出雙手幫助別人，是身而為人很重要的一部份。&lt;/p&gt;
&lt;p&gt;除了這些內在因素，參與開源專案工作，也可以得到許多回報。其中一項，是獲得別人的敬重：當我們創造新的事物與人分享，進而吸引人們一同合作時，人們自然會認識我們的人品與才能，從而為我們自己帶來成就感。&lt;/p&gt;
&lt;p&gt;換個角度來看，這也意味著：我們應當對於加入專案的人表示尊重，這樣人們才會願意繼續參與專案的活動。&lt;/p&gt;
&lt;p&gt;欣賞別人的作品也很重要。當人們發表自己的作品，而您有機會與他們交流時，即使是一封簡單的電子郵件感謝函，說「您的專案對我很重要」，也足以營造出一種正向的文化，讓大家都能保有繼續創造的動力。&lt;/p&gt;
&lt;p&gt;懂得讚美也很重要。當您介紹專案時，不要忘了讚賞您身邊的人，讓大家認識這些人是誰、做了多麼棒的貢獻，以建立社群的認同感。&lt;/p&gt;
&lt;p&gt;之所以有那麼多人持續對開源專案保持興趣，其中一個原因是這樣的：在合力工作時，我們的能力會愈來愈強，能做的事也愈來愈多。&lt;/p&gt;
&lt;p&gt;光用簡單的算數來想：如果我們有兩倍的人，至少就可以寫兩倍多的程式，有三倍的人就可以寫出三倍的程式。不過，我們的能力遠遠不止這些。&lt;/p&gt;
&lt;p&gt;在一起合作時，我們可以透過彼此鼓勵，讓彼此變得更好更強大。當您看到其他人正在解決艱難的問題時，您不妨鼓勵他們，跟他們說：「你做得很好，而且我看得出來，你在未來會做得更棒。」&lt;/p&gt;
&lt;p&gt;僅僅是透過談話和分享，您就可以為他人培力，讓對方變得更好。&lt;/p&gt;
&lt;p&gt;還有一點就是，當許多人聚在一起的時候，每個人都有不同的能力。一起工作時，可能您知道專案需要的五樣東西，而其他人知道另外五樣東西，您們互補長短，就有了一整套技能足以完成專案，而這是單打獨鬥時做不到的事情。&lt;/p&gt;
&lt;p&gt;所以在多人合作時，不只是生產力倍增，還可以達到互相加乘的效果。&lt;/p&gt;
&lt;p&gt;另一件很重要的事，是鼓勵彼此放眼未來、看得更遠。我們可以給其他人靈感，幫助他們解決有意思的問題。有時，只要說「我有這個想法...」，別人就可以將它化為現實。&lt;/p&gt;
&lt;p&gt;有些時候，您只要看看別人在做些什麼，然後告訴他們您想到的關鍵之處，不必自己跳下去實作，也可以幫助他們走得更好更遠。&lt;/p&gt;
&lt;p&gt;在做開源工作時，我們得時常提醒自己，我們並不是孤身一人。由於需要和許多人合作，我們最需要注意的，就是不斷改進自己的溝通技巧。&lt;/p&gt;
&lt;p&gt;我們經常會彼此溝通對未來的規劃，例如軟體專案的發展藍圖，以及我們的個人計劃，像是接下來想要實作哪些功能等等。&lt;/p&gt;
&lt;p&gt;在開源社群中，我注意到一件事情：人們對如何做軟體往往有很好的規劃，可是卻由於缺乏良好的溝通，而讓彼此的計劃互相衝突。如果您朝向某個規劃埋頭開發，而沒有與人溝通的話，很可能會傷害到其他朝向不同方向開發的人。&lt;/p&gt;
&lt;p&gt;我們就像一窩在蜂巢裡的蜜蜂，要經常發出嗡嗡聲，才能讓彼此持續發揮功能。&lt;/p&gt;
&lt;p&gt;此外，我們還會不時討論技術問題，嘗試找出最好的解決方案。在面對技術問題的時候，人們可能會互相爭論、甚至大動肝火，讓事情難以獲得實質的進展。&lt;/p&gt;
&lt;p&gt;所以，我們在工作過程裡，要逐漸學會接受各種各樣的可能性。對於您自己想到的解法，您當然應該持續努力，但也不妨對別人所提出的其他可能性，抱持開放的態度。&lt;/p&gt;
&lt;p&gt;而在您自己的工作有所進展時，也可以透過各種通訊管道，讓大家知道您做了些什麼。發電郵、寫推特… 有很多方法能讓人們知道您的進度。&lt;/p&gt;
&lt;p&gt;有時候我們可能會覺得害羞，或是不想被別人認為自己在吹噓。但其實事情完全不是這樣！多溝通對專案有好處，對專案裡的人也是好事，因為他們可以從您所作的事情裡學到東西。&lt;/p&gt;
&lt;p&gt;溝通的另一個重點是問問題。有社群的好處，就是可能有人已經解決過您正在面對的問題。透過論壇或聊天室主動發問，可以為您省去很多時間。&lt;/p&gt;
&lt;p&gt;同樣的道理，當別人想要學習時，您也可以認真回應，而不是對簡單的問題拋下一句「RTFM（去看該死的說明書）」就算了。&lt;/p&gt;
&lt;p&gt;如果您回答「RTFM」，的確可以為自己省些時間，但是您一旦這麼做，同時也是在告訴別人說，他們一開始就不應該問問題。而這絕對不是您想要的效果，您要的是培養對方溝通的意願。&lt;/p&gt;
&lt;p&gt;學著如何去給別人有幫助的答案，幫助他們一同走上這條開源之道，日後他們才能把這條路走得更長、更遠。&lt;/p&gt;
&lt;p&gt;有些時候，批評別人是必要的。雖然我們對各種可能性抱持開放的態度，但針對特定的技術問題，確實可能有某種解法比其他的都要正確。即使如此，當您想要讓別人改變他們的看法，最好的方式是用友善的態度提出回應，對方才會用開放的胸懷來向您學習。&lt;/p&gt;
&lt;p&gt;即使對方態度惡劣，也請保持優雅。難免有些人會對您很不客氣，但這也是參與開源的必經之路。有時候，臉皮厚一點也有好處。雖然有些人的溝通方式有待加強，但他們說的內容或許也有可取之處，您還是可以從中學到東西。&lt;/p&gt;
&lt;p&gt;從這個角度來看，就算人們說話的時候不禮貌，您還是可以禮貌地回應他們。&lt;/p&gt;
&lt;p&gt;溝通的另一部分不是說話，而是傾聽。有時我們須要做的，不是告訴別人我們的想法，而是靜靜地坐好，讓別人暢所欲言。&lt;/p&gt;
&lt;p&gt;光是聆聽是不夠的，我們還需要有同理心。英文有句俗話說：「如果您真想瞭解某人的話，請穿上他的鞋走一哩路。」 — 或許只有這樣，您才能明白別人所經過的煎熬。&lt;/p&gt;
&lt;p&gt;有些人以為，能夠從事開源軟體工作的人，個個都得是天才。事實絕非如此。的確有 Larry、Guido、Linus 這樣的人物，但其實任何一個專案，都需要各方面具有不同才能的人加入。&lt;/p&gt;
&lt;p&gt;重要的是，無論您有多聰明，都要保持謙虛。因為只有謙虛的人，才能以開放的態度面對其他人，學會用新方法來做事。謙遜的心態，讓您能歡迎其他人加入您的專案。相反的，抱持驕傲自大的態度，就等於是在跟其他人說：「我不需要你們，我用自己的方法做事就夠了。」&lt;/p&gt;
&lt;p&gt;也是因為謙遜，我們才能歡迎各種性別、各種文化的人加入社群，為開源軟體帶來多元而豐富的人才。&lt;/p&gt;
&lt;p&gt;就像各個國家有不同的語言和文化一樣，相同的多元性，也體現在各式各樣的開源專案裡。舉例來說，Linux 社群、Perl 社群、Ruby 社群和 Python 社群，都各自用獨特的方式來交流合作。&lt;/p&gt;
&lt;p&gt;只要我們懷著一顆謙卑的心，就可以看到自己專案所屬的社群並不是唯一的途徑，也才能夠欣賞其他社群裡的合作方式。&lt;/p&gt;
&lt;p&gt;另外，做開源專案並不只是享受樂趣而已。樂趣當然是有，但同時也有責任。當您承諾參與一個專案時，您是讓雙肩扛上了重量。這是件好事，因為責任能讓我們進步，變成更好的人。&lt;/p&gt;
&lt;p&gt;但是人生中還有其他的事情，像是您的伴侶、父母、孩子、職業等等。對於開源專案，我們可能會承擔一段時間的責任，但到了某天，我們可能會發現，自己不能再負起那麼多的責任了。&lt;/p&gt;
&lt;p&gt;我們要意識到這是一個循環。一開始我們加入社群，然後逐漸負起越來越多的責任。但當人生到達某個階段之後，您總會逐漸減少所負的責任。這個過程完全是自然的，而且在專案的生命週期裡一定會發生。&lt;/p&gt;
&lt;p&gt;所以我們不妨想想：「哪天我無法再付出那麼多心力的時候，誰來繼續我的工作呢？」&lt;/p&gt;
&lt;p&gt;為了確保其他人能繼續我們的工作，我們可以創造出某種持續前進的過程：盡力教導與分享我們所學到的一切，同時也向其他人學習更多的事物。這是一個不斷吸收與分享知識的過程。&lt;/p&gt;
&lt;p&gt;最後，當您在為開源工作的時候，請保持快樂吧，讓您的臉上帶著笑容，讓其他人分享您的喜悅！因為正是這種樂趣給予我們力量，讓我們能創造出偉大的事物。&lt;/p&gt;
&lt;p&gt;您現在更快樂了嗎？:-)&lt;/p&gt;</content>
		<author>
			<name>audreyt</name>
			<uri>http://pugs.blogs.com/pugs/</uri>
		</author>
		<source>
			<title type="html">Pugs</title>
			<subtitle type="html">Implementing Perl 6... and other related technologies.</subtitle>
			<link rel="self" href="http://pugs.blogs.com/pugs/index.rdf"/>
			<id>http://pugs.blogs.com/pugs/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Back from Oslo</title>
		<link href="http://ttjjss.wordpress.com/2012/04/23/back-from-oslo/"/>
		<id>http://ttjjss.wordpress.com/?p=156</id>
		<updated>2012-04-23T18:30:08+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;And so the hackathon is over. I haven’t experienced anything this awesome since I discovered how well bacon tastes with maasdamer.&lt;/p&gt;
&lt;p&gt;I seem to be much more productive during hackathons if I have no talk to prepare. I’ve had lots of plans about it (see previous post), and while I haven’t started even half of them I think, I’m really satisfied with what was achieved.&lt;/p&gt;
&lt;p&gt;On friday I looked a little bit into how Rakudo loads precompiled modules and why doesn’t it always work as expected. The easiest one to notice was Test.pm, which for some unknown reason was installed only as a source file, not a precompiled module. A simple fix in the Makefile, and suddenly &lt;strong&gt;every test file you ever run runs about 3.5 seconds faster.&lt;/strong&gt; Suddenly it makes module development a lot less painful.&lt;/p&gt;
&lt;p&gt;The other thing about module loading was that a lib/ directory was always at the very beginning of the @*INC array – that means that precompiling your modules (which usually puts them in blib/) before running your tests gave you… right. Absolutely nothing. How significant is that? Well, tests of Panda take just under 7 seconds when you have the modules precompiled, and almost 23 seconds when they aren’t. So that’s about &lt;strong&gt;3 times faster test runs for your modules&lt;/strong&gt;. How cool is that?&lt;/p&gt;
&lt;p&gt;That solved pretty much all the issues and wtf’s I’ve experienced with module precompilation. It took me another commit on saturday to teach panda to precompile modules again. Then my mind wandered again around the idea of emmentaler, a service for automatic smoke testing of Perl 6 modules. A quick and dirty 100-lines long script is now able to download all the modules, test them and present the results in &lt;strong&gt;&lt;a href=&quot;http://tjs.azalayah.net/new.html&quot;&gt;a bit silly, but definetely useful way&lt;/a&gt;&lt;/strong&gt;. There’s still lots of things to be done about it, but the fact that you can test all the modules in about 20 minutes is something that wasn’t quite possible before. Huge success; I hope I can turn it into something that the whole community will benefit.&lt;/p&gt;
&lt;p&gt;Saturday also brought a couple of fixes to Pod handling and the –doc command line switch. After a quick discussion with Damian Conway, sort of a “what does the spec really expect me to do”, I taught &lt;strong&gt;–doc to Do The Right Thing&lt;/strong&gt; whatever argument you pass to it. So –doc=HTML will use Pod::To::HTML for Pod formatting, and whatever module you write is available to be used this way without changes neither in Rakudo nor in the module code itself. A small thing, but something that waited much too long to be done after GSoC. It should now be possible to extract documentation from modules in a simple, automatic way, possibly for inclusion on modules.perl6.org or somewhere? We’ll see about that.&lt;/p&gt;
&lt;p&gt;The same day Marcus Ramberg worked on Pod::To::Text, in particular the .WHY handling part. He also contributed some patches to Rakudo itself, and thanks to him what –doc prints for documented subs and methods is actually Something Useful and not Something That’s Good That It Exists. Much appreciated!&lt;/p&gt;
&lt;p&gt;Sunday brought some new fixes to &lt;strong&gt;Bailador::Test, which now does almost everything that Dancer::Test does&lt;/strong&gt;, so some brave soul could actually start porting tests from Dancer to Bailador to see what blows up. I’ve also spent plenty of time (mostly compilation time) chasing small things like a few-months-old panda bug, which actually turned out to be a Rakudobug, making perl6 –doc behave a bit more like perldoc, and less like “what the hell does this beast do”, and some other small things.&lt;/p&gt;
&lt;p&gt;Besides hacking there was also plenty of opportunities to walk around Oslo, try some delicious food and beer and meet people mostly known from IRC before. Social aspect of the Hackathon was probably the best part of it, even given the fact that the coding aspect was probably the best one I’ve ever experienced. This wouldn’t have been possible without the work that the organizers have put into the event. It was absolutely perfect. Thank you, Oslo.pm! And thank you, sjn for giving me the opportunity to be there. It was a great hackathon and a time well spent. I hope to see you guys sooner than later. And if later than sooner, let it be the next hackathon in Oslo, for there’s no way that I’ll let this one happen without me.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://ttjjss.files.wordpress.com/2012/04/img_3935.jpg&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;alignnone size-medium wp-image-194&quot; height=&quot;208&quot; src=&quot;http://ttjjss.files.wordpress.com/2012/04/img_3935.jpg?w=300&amp;amp;h=208&quot; title=&quot;Some of the hackathoners from Oslo&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/ttjjss.wordpress.com/156/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/ttjjss.wordpress.com/156/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/ttjjss.wordpress.com/156/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/ttjjss.wordpress.com/156/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/ttjjss.wordpress.com/156/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/ttjjss.wordpress.com/156/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/ttjjss.wordpress.com/156/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/ttjjss.wordpress.com/156/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/ttjjss.wordpress.com/156/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/ttjjss.wordpress.com/156/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/ttjjss.wordpress.com/156/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/ttjjss.wordpress.com/156/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/ttjjss.wordpress.com/156/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/ttjjss.wordpress.com/156/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=ttjjss.wordpress.com&amp;amp;blog=15099040&amp;amp;post=156&amp;amp;subd=ttjjss&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>ttjjss</name>
			<uri>http://ttjjss.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Whatever but Cool » Perl</title>
			<link rel="self" href="http://ttjjss.wordpress.com/category/perl/feed/"/>
			<id>http://ttjjss.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 Hackathon in Oslo: Report From The Second Day</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2012-oslo-hackathon-rest.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2012-oslo-hackathon-rest.html</id>
		<updated>2012-04-23T16:24:30+00:00</updated>
		<content type="html">&lt;p&gt;Second day of the &lt;a href=&quot;https://gist.github.com/1711730&quot;&gt;Perl 6 Patterns
Hackathon&lt;/a&gt;. My plans to get the rest of placeholders and prepared
statements working in the Postgresql backend for MiniDBI succeed about 10
minutes after midnight. I just wanted to give them a very quick try before
going to bed, and was successful. Then I went to sleep.&lt;/p&gt;

&lt;p&gt;It was night, and it was morning. Second day.&lt;/p&gt;

&lt;p&gt;Next I wrote an SQLite backend for MiniDBI. It blocked on missing features
in our native call infrastructure, on which arnsholt worked in parallel. So I
haven't had a chance to try the SQLite backend yet. It probably requires some
substantial amount of work before it will run, but at least it compiles.&lt;/p&gt;

&lt;p&gt;I also investigated prepared statements and placeholders for the mysql
backend. This is much less straight forward, because it requires filling in
members of structs, not just function calls. This by itself wouldn't be much a
problem, our native call infrastructure supports that. The problem is that
it's a struct of mixed &quot;private&quot; and &quot;public&quot; members, so modelling the
structure in Perl 6 requires modeling private data of the mysql client
library. While possible, I don't find it desirable, because it is rather
fragile.&lt;/p&gt;

&lt;p&gt;Another notable event was the hacking dojo, where about 8 of us
collaborated to write a roman numeral conversion, using pair programming, and
fixed cycles of first writing a failing test, then getting it to run in the
simplest possible way, and finally refactoring it. It was quite an interesting
and fun experience.&lt;/p&gt;

&lt;p&gt;I spent much of the rest of the hackathon discussing things. For example
Patrick Michaud gave a quick walk through of how lists and related types are
implemented and iterated in Rakudo.&lt;/p&gt;

&lt;p&gt;In the evening we had very tasty Vietnamese food, and generally a good
time.&lt;/p&gt;

&lt;p&gt;Again it was a very productive and enjoyable day, and I'm very grateful for
being invited to the Hackathon.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Speed up by a factor of 6 million</title>
		<link href="http://strangelyconsistent.org/blog/speed-up-by-a-factor-of-6-million"/>
		<id>tag:strangelyconsistent.org,2012-04-22:blog/speed-up-by-a-factor-of-6-million</id>
		<updated>2012-04-22T21:39:00+00:00</updated>
		<content type="html">&lt;p&gt;By the end of March, I received an email saying this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ time perl t4.pl
total: 4783154184978

real    0m0.185s
user    0m0.176s
sys     0m0.004s

(requires a perl with 64bit integers)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There was a &lt;code&gt;t4.pl&lt;/code&gt; file attached.&lt;/p&gt;

&lt;p&gt;You may recognize the total that the program prints out is the total number of t4 configurations, the same number that it took my C program &lt;a href=&quot;http://strangelyconsistent.org/blog/counting-t4-configurations&quot;&gt;two weeks to calculate&lt;/a&gt; on a decent box. So somehow, Salvador Fandino, perl.org blogger and occasional reader of my blog, managed to find way to arrive at the answer &lt;a href=&quot;http://www.wolframalpha.com/input/?i=two+weeks+divided+by+0.185+seconds&quot;&gt;6 million times as fast&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Well, that's interesting. To say the least.&lt;/p&gt;

&lt;p&gt;Maybe I should be super-embarrassed. Maybe my cheeks should cycle through previously un-attained shades of crimson as I ponder the fact that my program was 6 million times as slow as someone else's. Ouch! But, I dunno. I don't really see it that way. I got to write about something I care about. Salvador++ cared enough to improve on my methods. The world is a better place. Blogging is cool — I learn stuff. Prestige doesn't much enter into it — the next time I'll have a better tool in my toolbox.&lt;/p&gt;

&lt;p&gt;So, let's investigate this new tool, and how it's better.&lt;/p&gt;

&lt;p&gt;First off, to get a factor-6e6 speedup, you don't apply some simple optimization somewhere; you use a different method. Salvador's code doesn't try to &lt;em&gt;enumerate&lt;/em&gt; all the configurations, it just gets at the number. Which makes a lot of sense in retrospect, since we're not using the individual configurations for anything. My program arrives at each individual configuration, but then just throws it away immediately. Wasteful.&lt;/p&gt;

&lt;p&gt;Salvador's blog post is &lt;a href=&quot;http://blogs.perl.org/users/salvador_fandino/2012/03/solving-carl-masaks-counting-t4-configurations-problem-in-pure-perl-5.html&quot;&gt;as brief as his email&lt;/a&gt;. But let's copy the code over here and talk about it a bit:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/perl

use strict;
use warnings;

my $tab = &amp;lt;&amp;lt;EOT;
-----xxx
------xx
x-----xx
x------x
xx-----x
xx------
xxx-----
EOT

my $vertical = index $tab, &quot;\n&quot;;
my $diagonal = $vertical + 1;

my $acu = { $tab =&amp;gt; 1 };

for my $ix (0 .. length($tab) - 1) {
    my %next;
    while (my ($k, $c) = each %$acu) {
        my $s = substr($k, 0, 1, '');
        $next{$k} += $c;
        if ($s eq '-') {
            my $k1 = $k;
            if ($k1 =~ s/^-/x/) { # horizontal xx
                $next{$k1} += $c;
                if ($k1 =~ s/^x-/xx/) { # horizontal xxx
                    $next{$k1} += $c;
                }
            }
            $k1 = $k;
            if ($k1 =~ s/^(.{$vertical})-/${1}x/os) { # vertical xx
                $next{$k1} += $c;
                if ($k1 =~ s/^(.{$vertical}x.{$vertical})-/${1}x/os) {  # vertical xxx
                    $next{$k1} += $c;
                }
            }
            $k1 = $k;
            if ($k1 =~  s/^(.{$diagonal})-/${1}x/os) { # diagonal xx
                $next{$k1} += $c;
                if ($k1 =~ s/^(.{$diagonal}x.{$diagonal})-/${1}x/os) {  # diagonal xxx
                    $next{$k1} += $c;
                }
            }
        }
    }
    $acu = \%next;
}

my ($k, $c) = each %$acu;
print &quot;total: $c\n&quot;;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The code is wonderfully idiomatic and to-the-point. Here are a few highlights, as I see them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The board is a string. It's one-dimensional, but it plays a 2D array on TV. Some cute regexes then do matches on it according to this 2D representation.&lt;/li&gt;
&lt;li&gt;We've &quot;compressed&quot; the hexagonal aspect of the board into a rectangular view. You know brick walls? On every other level the bricks are &quot;between&quot; those on the levels above/below. It's like they have half-valued x coordinates. This board representation removes the halves and just puts the bricks right on top of each other. It's bad for building walls, but useful for memory layout. It does mean that one of the diagonals on the hex layout becomes a vertical in the rectangular layout.&lt;/li&gt;
&lt;li&gt;The script &quot;munches&quot; through the board, eating it one character at a time. In a very real way, this program solves the problem by eating it.&lt;/li&gt;
&lt;li&gt;At each point it finds an empty location, it tries to put all kinds of 2-pieces and 3-pieces at that location. It &lt;em&gt;diverges&lt;/em&gt; into all alternatives, keeping track for each alternative what locations it's used up.&lt;/li&gt;
&lt;li&gt;The alternatives will then &lt;em&gt;converge&lt;/em&gt; naturally as the same half-munched board shows up in various alternative paths. The script just needs to keep track of multiplicity of each alternative.&lt;/li&gt;
&lt;li&gt;By the time we've muched the whole board down to an empty string, everything will have converged, so the multiplicity of the empty board will magically equal all possible ways to munch up the original one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The program does far too much destructive updating for my tastes. I realize when I look at it that I no longer &quot;think&quot; in terms of these destructive updates. But it does it so &lt;em&gt;successfully&lt;/em&gt; and idiomatically, that I find it difficult to list it as a disadvantage. Maybe it's a Perl 5 thing. Constructs like &lt;code&gt;s///&lt;/code&gt; are terribly convenient, and their default is to mutate things. (Even though Perl 5.14 &lt;a href=&quot;http://perldoc.perl.org/perl5140delta.html#Regular-Expressions&quot;&gt;adds &lt;code&gt;/r&lt;/code&gt; for non-destructive substitution&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;I was curious how this script would look (and perform) in Perl 6, so I wrote a straight port of it, trying to stick to the original as closely as possible:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;my $tab = join &quot;\n&quot;, &amp;lt;
    -----xxx
    ------xx
    x-----xx
    x------x
    xx-----x
    xx------
    xxx-----
&amp;gt;;

my $vertical = index $tab, &quot;\n&quot;;
my $diagonal = $vertical + 1;

my %acu = $tab =&amp;gt; 1;

my $vertical_xx = eval(&quot;/^ (. ** $vertical) '-'/&quot;);
my $vertical_xxx = eval(&quot;/^ (. ** $vertical 'x' . ** $vertical) '-'/&quot;);
my $diagonal_xx = eval(&quot;/^ (. ** $diagonal) '-'/&quot;);
my $diagonal_xxx = eval(&quot;/^ (. ** $diagonal 'x' . ** $diagonal) '-'/&quot;);

for ^$tab.chars {
    my %next;
    for %acu.kv -&amp;gt; $k, $c {
        my $s = $k.substr(0, 1);
        my $k0 = $k.substr(1);
        %next{$k0} += $c;
        next unless $s eq '-';
        my $k1 = $k0;
        if $k1.=subst(/^ '-'/, 'x') ne $k0 { # horizontal xx
            %next{$k1} += $c;
            my $k2 = $k1;
            if $k2.=subst(/^ 'x-'/, 'xx') ne $k1 { # horizontal xxx
                %next{$k2} += $c;
            }
        }
        $k1 = $k0;
        if $k1.=subst($vertical_xx,
                      -&amp;gt; $/ { $0 ~ 'x' }) ne $k0 { # vertical xx
            %next{$k1} += $c;
            my $k2 = $k1;
            if $k2.=subst($vertical_xxx,
                          -&amp;gt; $/ { $0 ~ 'x' }) ne $k1 { # vertical xxx
                %next{$k2} += $c;
            }
        }
        $k1 = $k0;
        if $k1.=subst($diagonal_xx,
                      -&amp;gt; $/ { $0 ~ 'x' }) ne $k0 { # diagonal xx
            %next{$k1} += $c;
            my $k2 = $k1;
            if $k2.=subst($diagonal_xxx,
                          -&amp;gt; $/ { $0 ~ 'x' }) ne $k1 { # diagonal xxx
                %next{$k2} += $c;
            }
        }
    }
    %acu := %next;
}

say &quot;total: %acu.values()&quot;;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Ugh! This script is longer than the Perl 5 version, and it looks messier, too. A few factors contribute to that. First, you can't just do &lt;code&gt;s///&lt;/code&gt; in Rakudo in an &lt;code&gt;if&lt;/code&gt; statement. (You can in Niecza, though.) Second, there are problems with &lt;code&gt;&amp;lt;atom&amp;gt; ** $repeats&lt;/code&gt;, and I got to submit &lt;a href=&quot;https://rt.perl.org/rt3/Ticket/Display.html?id=112450&quot;&gt;two&lt;/a&gt; &lt;a href=&quot;https://rt.perl.org/rt3/Ticket/Display.html?id=112454&quot;&gt;tickets&lt;/a&gt; about that, and then do a workaround with the &lt;code&gt;eval&lt;/code&gt;s you see above. (Aah. Feels like the old days.)&lt;/p&gt;

&lt;p&gt;Furthermore, jnthn++ could put this program into the profiler, and get &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/f524138d1d29c99fa9963c7463afd34eda69c133&quot;&gt;two&lt;/a&gt; &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/d6cd1e2bd19e03a81132a23b2025920577f84e37&quot;&gt;optimizations&lt;/a&gt; out of it. It went from 40s on my machine, to 37s.&lt;/p&gt;

&lt;p&gt;But in the end, I felt that my straight-port version suffers from not playing off Perl 6's strengths. So I wrote a version that leans more towards immutability and closures.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;my $tab = join &quot;\n&quot;, &amp;lt;
    -----xxx
    ------xx
    x-----xx
    x------x
    xx-----x
    xx------
    xxx-----
&amp;gt;;

my $vertical = index $tab, &quot;\n&quot;;
my $diagonal = $vertical + 1;

my %acu = $tab =&amp;gt; 1;

sub make_substituter($rx) {
    return sub ($tab) {
        my $newtab = $tab;
        return $newtab
            if $newtab.=subst($rx, -&amp;gt; $/ { $0 ~ 'x' }) ne $tab;
    };
}

sub make_2x_substituter($rx) {
    return sub ($tab) {
        my $newtab = $tab;
        return $newtab
            if $newtab.=subst($rx, -&amp;gt; $/ { [~] $0, 'x', $1, 'x' }) ne $tab;
    };
}

my @pieces = 
    make_substituter(rx/^ ('') '-'/),
    make_substituter(eval(&quot;/^ ({'.' x $vertical}) '-'/&quot;)),
    make_substituter(eval(&quot;/^ ({'.' x $diagonal}) '-'/&quot;)),
    make_2x_substituter(rx/^ ('') '-' ('') '-'/),
    make_2x_substituter(eval(&quot;/^ ({'.' x $vertical}) '-' ({'.' x $vertical}) '-'/&quot;)),
    make_2x_substituter(eval(&quot;/^ ({'.' x $diagonal}) '-' ({'.' x $diagonal}) '-'/&quot;));

for ^$tab.chars {
    my %next;
    for %acu.kv -&amp;gt; $k, $c {
        my $s = $k.substr(0, 1);
        my $k0 = $k.substr(1);
        %next{$k0} += $c;
        next unless $s eq '-';
        for @pieces -&amp;gt; &amp;amp;piece {
            if &amp;amp;piece($k0) -&amp;gt; $newtab {
                %next{$newtab} += $c;
            }
        }
    }
    %acu := %next;
}

say &quot;total: %acu.values()&quot;;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Hmm. The loop is shorter now, but at the cost of some abstractions in other places. It's an improvement on my first version, but I don't really feel I got close to the succinctness of Salvador's Perl 5 version here either. (And this version runs slower, predictably. Something like 52s on my machine.)&lt;/p&gt;

&lt;p&gt;I'm pretty sure it's possible to make even more idiomatic versions. This is a large enough problem to make things interesting. I encourage others to try.&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Revenge of the Oslo hackathon</title>
		<link href="http://strangelyconsistent.org/blog/revenge-of-the-oslo-hackathon"/>
		<id>tag:strangelyconsistent.org,2012-04-22:blog/revenge-of-the-oslo-hackathon</id>
		<updated>2012-04-22T21:05:00+00:00</updated>
		<content type="html">&lt;p&gt;A month of blog silence. Ouch. Looking back, the three reasons I can see for my
absence from blogging are work, work, and work.&lt;/p&gt;

&lt;p&gt;So I saw
&lt;a href=&quot;http://perlgeek.de/blog-en/perl-6/2012-oslo-hackathon-report.html&quot;&gt;moritz&lt;/a&gt;,
&lt;a href=&quot;https://6guts.wordpress.com/2012/04/21/hackathoning-in-oslo/&quot;&gt;jnthn&lt;/a&gt;, and
&lt;a href=&quot;http://pmthium.com/2012/04/22/oslo-perl-6-patterns-hackathon-days-1-2/&quot;&gt;pmichaud&lt;/a&gt;
blog about the weekend, and I must've been too shell-shocked to think to do the
same. sjn++ woke me up from my reverie by asking me outright.&lt;/p&gt;

&lt;p&gt;So, here goes.&lt;/p&gt;

&lt;p&gt;Oslo. We had a hackathon there.&lt;/p&gt;

&lt;p&gt;This is the second time. The first time was in 2009, and was quite possible the
best hackathon &lt;em&gt;ever&lt;/em&gt;, in the history of Perl 6 hackathons. (Or, let's say,
certainly among the top 5.)&lt;/p&gt;

&lt;p&gt;I haven't fully processed this one, but it's not too early to say this: this
one beat the last one.&lt;/p&gt;

&lt;p&gt;My weekend, in brief:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;jnthn and I arrived Oslo on the Thursday, and watched Damian Conway giving
and awesome presentation in a bar. No-one combines geek jokes, almost-accurate
physics, and Perl programming like Damian.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the Saturday, I spent about an hour introducing a group of newcomers to
Perl 6, language and culture. Fun!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;infosophy++ (Geir Amdal) liked my
&lt;a href=&quot;http://strangelyconsistent.org/blog/helpfully-addictive-tdd-on-crack&quot;&gt;tote&lt;/a&gt;
script so much that he did something I never got around to doing: he
&lt;a href=&quot;https://github.com/gam/test-junkie/&quot;&gt;published it as a module&lt;/a&gt;. As part of
this, he &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/edf2e0d5d7e9ea7c3417717f163698113692e165&quot;&gt;added back a bunch of IO
methods&lt;/a&gt;
that got lost in the ng→nom transition, and also &lt;a href=&quot;https://github.com/perl6/roast/commit/a45e1b21d8529fe2a3dd3d3940a2941fa5869d43&quot;&gt;added spectests for
them&lt;/a&gt;.
As part of this, he became the 100th developer in the perl6 organization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;sergot++ (Filip Sergot) and I built a presentation framework. It's called
&lt;a href=&quot;https://github.com/masak/sambal&quot;&gt;Sambal&lt;/a&gt;, and it &lt;a href=&quot;https://gist.github.com/2173720&quot;&gt;turns a DSL into a
PDF&lt;/a&gt;. I'm happy and proud over how long we
managed to get with only two days of work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;sergot++ and I also spit out a
&lt;a href=&quot;https://github.com/masak/markdown&quot;&gt;&lt;code&gt;Text::Markdown&lt;/code&gt;&lt;/a&gt; module. It's in early
stages yet, but it already services Sambal in its slide generation. It's an
easy addition to have its objects model serialize to HTML, too.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I asked whether &lt;code&gt;BEGIN&lt;/code&gt; should trigger immediately inside a &lt;code&gt;quasi&lt;/code&gt;, or
whether it should trigger only after macro application. People around the
hackathon table suggested that we should have a &lt;code&gt;QBEGIN&lt;/code&gt; that did the latter.
I felt it was a singularly bad idea, so I asked TimToady. He suggested the
same. &lt;a href=&quot;http://irclog.perlgeek.de/perl6/2012-04-21#i_5474527&quot;&gt;I exploded&lt;/a&gt;.
Then I decided not to listen to anyone, and just implement it in the way that
turned out to be natural and convenient. pmichaud joked that he should have
adopted that approach long ago with respect to implementing Perl 6.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(But seriously. If you want to execute a BEGIN block at macro-parse time,
put it outside of the quasi. If you want to execute it at macro-apply time,
put it inside of it. We don't need a &lt;a href=&quot;http://en.wikipedia.org/wiki/Q*bert&quot;&gt;Q*bert
&lt;code&gt;BEGIN&lt;/code&gt;&lt;/a&gt;.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We discussed what &lt;code&gt;s///&lt;/code&gt; should evaluate to. No real consensus. &lt;code&gt;:-(&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the Sunday, we tried a coding dojo (hosted by infosophy++),
implementing a roman numerals &lt;code&gt;Int -&amp;gt; Str&lt;/code&gt; converter in Perl 6. It led to
interesting discussions, and many of us had useful insights in collaborative
coding and small-step iterative development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;frettled++ &lt;a href=&quot;http://howcaniexplainthis.blogspot.se/2012/04/oslopm-patterns-hackathon-pictures.html&quot;&gt;took some nice
pictures&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;jnthn++ and pmichaud++ evolved a plan for the new QAST redesign, which will
enable &lt;a href=&quot;http://strangelyconsistent.org/blog/macros-progress-report-d1-merged&quot;&gt;the next
step&lt;/a&gt;
in the macros grant. jnthn++ invited me to write some tests on this for great
success. It looks doable; I'll dig into this during the next week. As I do
this, I can also write tests for my new &lt;code&gt;QAST::Unquasi&lt;/code&gt; node type.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If Oslo.pm ever hosts a third hackathon, my expectations will found be in
geostationary orbit. No chance in the world I'd miss it.&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Oslo.pm Patterns Hackathon pictures</title>
		<link href="http://howcaniexplainthis.blogspot.com/2012/04/oslopm-patterns-hackathon-pictures.html"/>
		<id>tag:blogger.com,1999:blog-753668960778118906.post-1443622212099747175</id>
		<updated>2012-04-22T16:59:00+00:00</updated>
		<content type="html">&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-l1rTPaVa8nk/T5QaVsIvVdI/AAAAAAAAAdo/ymJYeD57gyc/s1600/IMG_3932.jpg&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;214&quot; src=&quot;http://4.bp.blogspot.com/-l1rTPaVa8nk/T5QaVsIvVdI/AAAAAAAAAdo/ymJYeD57gyc/s320/IMG_3932.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Hacking: sjn, moritz (back), pmichaud, jnthn, masak, tadzik, sergot, bjarneh&lt;/p&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-n5YyCh7Z6WQ/T5QaV7a2FqI/AAAAAAAAAdw/Veypcp-8nng/s1600/IMG_3934.jpg&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;214&quot; src=&quot;http://4.bp.blogspot.com/-n5YyCh7Z6WQ/T5QaV7a2FqI/AAAAAAAAAdw/Veypcp-8nng/s320/IMG_3934.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Hacking: imarcusthis, infosophy&lt;/p&gt;&lt;/div&gt;&lt;hr /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-0svqBX518-4/T5QaWftYr1I/AAAAAAAAAd8/mRlYKBZlkfc/s1600/IMG_3935.jpg&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;222&quot; src=&quot;http://4.bp.blogspot.com/-0svqBX518-4/T5QaWftYr1I/AAAAAAAAAd8/mRlYKBZlkfc/s320/IMG_3935.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Posing, back to front, left to right:&lt;br /&gt;infosophy, moritz, arnsholt, sjn, krunen, masak&lt;br /&gt;tadzik, jnthn, frettled, pmichaud&lt;/p&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/753668960778118906-1443622212099747175?l=howcaniexplainthis.blogspot.com&quot; width=&quot;1&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>bakkushan</name>
			<uri>http://pipes.yahoo.com/pipes/pipe.info?_id=c30fa6b5be32693af535b6e46c4fabd6</uri>
		</author>
		<source>
			<title type="html">How Can I Explain This? - Perl 6</title>
			<subtitle type="html">Pipes Output</subtitle>
			<link rel="self" href="http://pipes.yahoo.com/pipes/pipe.run?_id=c30fa6b5be32693af535b6e46c4fabd6&amp;_render=rss"/>
			<id>http://pipes.yahoo.com/pipes/pipe.info?_id=c30fa6b5be32693af535b6e46c4fabd6</id>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 Hackathon in Oslo: Report From The First Day</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2012-oslo-hackathon-report.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2012-oslo-hackathon-report.html</id>
		<updated>2012-04-22T05:10:48+00:00</updated>
		<content type="html">&lt;p&gt;Yesterday I arrived in the beautiful city of Oslo to attend the &lt;a href=&quot;https://gist.github.com/1711730&quot;&gt;Perl 6 Patterns Hackathon&lt;/a&gt;.
Yesterday we visited a pub, had great discussions, food and beverages, and
generally a very good time.&lt;/p&gt;

&lt;p&gt;Today we met at 10 am, and got straight to hacking. We are located in an
office in the 6th floor of a big building, with a nice view over the center of
town, harbor, and even the Holmenkollen.&lt;/p&gt;

&lt;p&gt;I worked on the backtrace printer, which in alarmingly many cases reported
&lt;code&gt;Error while creating error string: Method 'message' not found for
invocant of class 'Any'&lt;/code&gt;, which wasn't too helpful.&lt;/p&gt;

&lt;p&gt;It turns out there were actually two causes. One was a subtle error in the
backtrace printer that was triggered by &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/6ef66c9521b14f33ded88c3da8569032488d2442&quot;&gt;stricter
    implementation of the specification&lt;/a&gt;, which was easy to find. The
second bug was harder to find, considering that you don't get easily get
backtraces from errors within the backtrace printer. In the end it was the
usage of a code object in boolean context, which turned out to be harmful.
Because regexes are also code objects, and in boolean context they search for
the outer &lt;code&gt;$_&lt;/code&gt; variable and try to match the regex against it.
Which failed. Hard to find, but easy to fix.&lt;/p&gt;

&lt;p&gt;My second big project today was database connectivity. Part of it was
pestering Jonathan to fix the issues that arose from module precompilation
mixed with calling C modules, and testing all the iterations he produced. I'm
happy to report that it now works fine, which speeds up development quite a
bit.&lt;/p&gt;

&lt;p&gt;I also fixed the postgres driver. The root cause for the failing tests
turned out to be rather simple too (a missing initialization), so simple that
it's embarrassing how long it took me to find out. On the plus side I improved
the code quite a bit in passing.&lt;/p&gt;

&lt;p&gt;So now all tests in &lt;a href=&quot;https://github.com/mberends/MiniDBI&quot;&gt;MiniDBI&lt;/a&gt; pass, which is a nice
milestone, and an indication that we need more tests.&lt;/p&gt;

&lt;p&gt;Tomorrow I plan to change the postgres driver to use proper prepared
statments.&lt;/p&gt;

&lt;p&gt;But the real value of such hackathon comes from interacting with the other
hackers. I'm very happy about lots of discussions with other core hackers, as
well as feedback and patches from new users and hackers.&lt;/p&gt;

&lt;p&gt;At this occasion I'd also like to thank the organizers, Salve J. Nilsen,
Karl Rune Nilsen and Jan Ingvoldstad. It has been a great event so far, both fun and productive. You are
doing a great service to the Perl 6 community, and to the hackers you have
invited.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Hackathoning in Oslo</title>
		<link href="http://6guts.wordpress.com/2012/04/21/hackathoning-in-oslo/"/>
		<id>http://6guts.wordpress.com/?p=214</id>
		<updated>2012-04-21T21:39:38+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;I’m in Oslo with a bunch of Perl 6 folks. It’s great to see old friends and meet some new ones – and we’re having a highly productive time. After a wonderful evening of tasty food and lovely beer (amongst others, a delicious imperial stout) yesterday, today has been solidly focused on Getting Stuff Done.&lt;/p&gt;
&lt;p&gt;I’m a little tired now, so here’s just a quick rundown of some of what I’ve been up to.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Since bounded serialization landed, we’ve had a few issues with pre-compilation of MiniDBI, the database access module. I’ve now tracked down all of the remaining issues there, fixed them. and happily moritz++ has been hacking lots on improving the module in other ways too. The MySQL and Postgres drivers now pass all the tests we have for them, which is some nice progress.&lt;/li&gt;
&lt;li&gt;I’ve been answering a few questions for arnsholt++, who has picked up the Zavolaj (native calling) module where I left off, adding support for passing/returning arrays of structs, structs pointing to arrays and various other permutations. This will greatly improve the range of C libraries that can be used with it.&lt;/li&gt;
&lt;li&gt;I had a design session with pmichaud++ on QAST, the successor to our current AST. The new nodes will integrate far better with 6model and bounded serialization, give us better native type handling and be much more memory efficient due to being able to use natively typed attributes in them. This is also a key part of our work towards getting Rakudo up and running on an extra back end.&lt;/li&gt;
&lt;li&gt;After that, I got the nodes fleshed out somewhat, and have started a little work on QAST::Compiler too. It’s underway!&lt;/li&gt;
&lt;li&gt;I also spent some time in the ticket queue and fixed a bunch of Rakudo bugs: constant initializers containing blocks now work out, state declarations together with list assignment work, $.foo/@.foo/%.foo now contextualize as they should, and :i now also applies to interpolated variables.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, lots of stuff – and that’s just the things I’ve been directly involved with.  It’s nice to be a part of this hive of activity…and tomorrow there’s another day of this! Catch you then. :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/214/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/6guts.wordpress.com/214/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/6guts.wordpress.com/214/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/6guts.wordpress.com/214/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/6guts.wordpress.com/214/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/6guts.wordpress.com/214/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/6guts.wordpress.com/214/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/6guts.wordpress.com/214/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/6guts.wordpress.com/214/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/6guts.wordpress.com/214/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/6guts.wordpress.com/214/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/6guts.wordpress.com/214/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/6guts.wordpress.com/214/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/6guts.wordpress.com/214/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=6guts.wordpress.com&amp;amp;blog=14597269&amp;amp;post=214&amp;amp;subd=6guts&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://6guts.wordpress.com</uri>
		</author>
		<source>
			<title type="html">6guts</title>
			<subtitle type="html">Tales of Perl 6 guts hacking</subtitle>
			<link rel="self" href="http://6guts.wordpress.com/feed/"/>
			<id>http://6guts.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">ABC module now works on Rakudo and Niecza</title>
		<link href="http://justrakudoit.wordpress.com/2012/04/19/abc-module-now-works-on-rakudo-and-niecza/"/>
		<id>http://justrakudoit.wordpress.com/?p=415</id>
		<updated>2012-04-19T18:29:15+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;I haven’t had many tuits to work on Perl 6 lately — except this week I needed to have three pages of transposed single-line sheet music ready to go for tonight’s rehearsal.  The ABC module (particularly the abc2ly.pl script to convert ABC to Lilypond) was the obvious choice to use.  However, to make it work well, I needed to add ties, slurs, multi-measure rests, fermatas, and text messages, as well as fixing the key change and meter change code.  While I was at it, I went ahead and got all the tests passing again under Rakudo (version 2012.02-173-gb13c517, the latest won’t build on my Mac) and for the first time, Niecza (latest source from github only, I actually added a small patch in the process).&lt;/p&gt;
&lt;p&gt;It feels so good to have this working under both compilers!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/justrakudoit.wordpress.com/415/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/justrakudoit.wordpress.com/415/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/justrakudoit.wordpress.com/415/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/justrakudoit.wordpress.com/415/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/justrakudoit.wordpress.com/415/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/justrakudoit.wordpress.com/415/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/justrakudoit.wordpress.com/415/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/justrakudoit.wordpress.com/415/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/justrakudoit.wordpress.com/415/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/justrakudoit.wordpress.com/415/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/justrakudoit.wordpress.com/415/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/justrakudoit.wordpress.com/415/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/justrakudoit.wordpress.com/415/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/justrakudoit.wordpress.com/415/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=justrakudoit.wordpress.com&amp;amp;blog=12219098&amp;amp;post=415&amp;amp;subd=justrakudoit&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>colomon</name>
			<uri>http://justrakudoit.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Just Rakudo It</title>
			<subtitle type="html">I Never Metaop I Didn't Like</subtitle>
			<link rel="self" href="http://justrakudoit.wordpress.com/feed/"/>
			<id>http://justrakudoit.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">t3: Addition chains</title>
		<link href="http://strangelyconsistent.org/blog/t3-addition-chains"/>
		<id>tag:strangelyconsistent.org,2012-04-14:blog/t3-addition-chains</id>
		<updated>2012-04-14T21:24:00+00:00</updated>
		<content type="html">&lt;div style=&quot;background: #ded; margin: 1em; padding: 1em;&quot;&gt;&lt;code&gt;&amp;lt;arnsholt&amp;gt; Heh. NP-complete problems in a
competition. That's just mean ^_^&lt;/code&gt;&lt;/div&gt;

&lt;p&gt;Ok, we're in the midst of reviewing &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;Perl 6 Coding Contest
2011&lt;/a&gt;
code submissions, and the turn has come to the third task: addition chains.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;For a positive integer N, an addition chain for N is a sequence
starting with 1, each subsequent element being the sum of two
earlier elements (possibly the sum of the same element twice),
and ending with N.

For example for N = 9, this is a possible addition chain:

    (1, 2, 4, 5, 8, 9)

because 2 = 1 + 1, 4 = 2 + 2, 5 = 1 + 4, etc.

But a minimal solution would be:

    (1, 2, 3, 6, 9)

Write a program that reads numbers N from standard input, one per line,
and outputs a minimal addition chain like the one above.

Sometimes there will be several possible solutions of minimal length.
That's fine; just pick one of them.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Addition chains are interesting from a computing standpoint, because of a
multiplication technique called &lt;a href=&quot;http://en.wikipedia.org/wiki/Addition-chain_exponentiation&quot;&gt;addition-chain
exponentiation&lt;/a&gt;,
by which you can use an addition chain for a certain &lt;code&gt;N&lt;/code&gt; to do a minimum
number of multiplications; the addition chain implicitly encodes a sequence of
multiplications to perform. So there's a genuine interest in finding shortest
addition chains.&lt;/p&gt;

&lt;p&gt;This is a hard problem. Finding addition chains is easy, but finding a
&lt;em&gt;minimal&lt;/em&gt; addition chain is not. Depsite arnsholt's quote above, it hasn't
been &lt;em&gt;proven&lt;/em&gt; NP-complete. Slightly more general problems have, but not this
exact one. We know it's tricky, though.&lt;/p&gt;

&lt;p&gt;Wikipedia has this to say about &lt;a href=&quot;http://en.wikipedia.org/wiki/Addition_chain#Methods_for_computing_addition_chains&quot;&gt;the
problem&lt;/a&gt;:
&quot;There is no known algorithm which can calculate a minimal addition chain for
a given number with any guarantees of reasonable timing or small memory
usage.&quot; That's what we're looking for in this contest: problems that are easy
to state, and that look quite straightforward, but that have hidden depth.&lt;/p&gt;

&lt;p&gt;Someone may look at the problem and think &quot;aha! dynamic programming!&quot; —
but, alas, as Wikipedia patiently explains:&lt;/p&gt;

&lt;div style=&quot;background: #ded; margin: 1em; padding: 1em;&quot;&gt;&lt;p&gt;Note that the problem of finding the shortest addition
chain cannot be solved by &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_programming&quot;&gt;dynamic
programming&lt;/a&gt;, because it
does not satisfy the assumption of &lt;a href=&quot;http://en.wikipedia.org/wiki/Optimal_substructure&quot;&gt;optimal
substructure&lt;/a&gt;. That is, it
is not sufficient to decompose the power into smaller powers, each of which is
computed minimally, since the addition chains for the smaller powers may be
related (to share computations). For example, in the shortest addition chain
for &lt;i&gt;a&lt;sup&gt;15&lt;/sup&gt;&lt;/i&gt; [...] the subproblem for &lt;i&gt;a&lt;sup&gt;6&lt;/sup&gt;&lt;/i&gt; must
be computed as &lt;i&gt;(a&lt;sup&gt;3&lt;/sup&gt;)&lt;sup&gt;2&lt;/sup&gt;&lt;/i&gt; since &lt;i&gt;a&lt;sup&gt;3&lt;/sup&gt;&lt;/i&gt;
is re-used (as opposed to, say, &lt;i&gt;a&lt;sup&gt;6&lt;/sup&gt; =
a&lt;sup&gt;2&lt;/sup&gt;(a&lt;sup&gt;2&lt;/sup&gt;)&lt;sup&gt;2&lt;/sup&gt;&lt;/i&gt;, which also requires three
multiplies).&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;This is probably why the problem looks approachable, because it sort of feels
like a dynamic-programming problem. But it ain't.&lt;/p&gt;

&lt;p&gt;People sent in solutions. &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/&quot;&gt;Go check them
out&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I was a bit concerned that people might find &lt;a href=&quot;http://www-cs-faculty.stanford.edu/~knuth/programs/strongchain.w&quot;&gt;Knuth's
solution&lt;/a&gt;
and just transcribe it into Perl 6. (Which would've been OK, if a bit boring
if everyone did it.) But no-one did that; instead, people started from
well-known algorithms, either
&lt;a href=&quot;http://en.wikipedia.org/wiki/Breadth-first_search&quot;&gt;breadth-first&lt;/a&gt; or
&lt;a href=&quot;http://en.wikipedia.org/wiki/Depth-first_search&quot;&gt;depth-first&lt;/a&gt; search.&lt;/p&gt;

&lt;p&gt;Perhaps the most remarkable things that can be recounted about the solutions
are the cases where they deviate from correctness in various ways. One solution
produced the right results for the first 76 chain lengths, but with &lt;code&gt;N = 77&lt;/code&gt;,
it went awry due to internal optimizations which turned out to be less than
innocent. (The first rule of optimaztion? &quot;Make sure you don't get caught.&quot;)&lt;/p&gt;

&lt;p&gt;Then there were two submitted algorithms that generated Brauer chains. &quot;What's
a Brauer chain?&quot;, I hear you asking. Hold tight and I'll tell you. A Brauer
chain is an addition chain where each new element is formed as the sum of the
&lt;em&gt;previous&lt;/em&gt; element and some element (possibly the same). Thus, of the two
examples from the description,&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(1, 2, 4, 5, 8, 9)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(1, 2, 3, 6, 9)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The latter is a Brauer chain, but the former isn't, because you can't get 8 by
summing 5 and some element in the chain.&lt;/p&gt;

&lt;p&gt;The task is to generate minimal addition chains. If some algorithm looks only
among the Brauer chains, will it ever omit some shorter chain from its search?
The answer, it turns out, highlights exactly why I like mathematics.&lt;/p&gt;

&lt;p&gt;A Brauer-based algorithm will fail the first time at &lt;code&gt;N = 12509&lt;/code&gt;. (See &lt;a href=&quot;http://books.google.se/books?id=1AP2CEGxTkgC&amp;amp;pg=PA169&amp;amp;lpg=PA169&amp;amp;dq=brauer+chain+12509&amp;amp;source=bl&amp;amp;ots=TjkugXGNnE&amp;amp;sig=wsVTOZ0OVyFruRFnpqgInngdUaw&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=XrhgT_HbBqjj4QSC0NXTDg&amp;amp;ved=0CB4Q6AEwAA#v=onepage&amp;amp;q=brauer%20chain%2012509&amp;amp;f=false&quot;&gt;this
reference&lt;/a&gt;,
provided by hakank++).&lt;/p&gt;

&lt;p&gt;Now, you might of course argue that failing at &lt;code&gt;N = 77&lt;/code&gt; is more wrong than
failing at &lt;code&gt;N = 12509&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Sheldon: &lt;em&gt;More&lt;/em&gt; wrong? &quot;Wrong&quot; is an absolute state and not subject to gradation.
Stuart: Of course it is! It's a little wrong to say a tomato is a vegetable. It's very wrong to say it's a suspension bridge.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;More precisely, there are infinitely many &lt;code&gt;N&lt;/code&gt; for which no Brauer chain is
minimal. 12509 just happens to be the smallest one.&lt;/p&gt;

&lt;p&gt;This task, understandably, is a tricky one to judge. We've tried to go easy on
the contestants (and non-contestants) in the reviews. After all, the problem
&lt;em&gt;is&lt;/em&gt; hard.&lt;/p&gt;

&lt;p&gt;Now, who wants to translate Knuth's solution to Perl 6? 哈哈&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Oslo.pm Perl 6 Patterns Hackathon 2012</title>
		<link href="http://howcaniexplainthis.blogspot.com/2012/04/oslopm-perl-6-patterns-hackathon-2012.html"/>
		<id>tag:blogger.com,1999:blog-753668960778118906.post-132283182020413800</id>
		<updated>2012-04-13T10:41:00+00:00</updated>
		<content type="html">In one week (2012-04-20 – 2012-04-22), a bunch of bright people will attend the &lt;a href=&quot;https://gist.github.com/1711730&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Perl 6 Patterns Hackathon&lt;/a&gt; in Oslo.&lt;br /&gt;&lt;br /&gt;Perl 6 – both its specification and implementations – will become one of the Great Ones. I admit that we are not quite there yet, but to me, Perl 6 is a language for the long term.&lt;br /&gt;&lt;br /&gt;In one of the meetings krunen, sjn and I had this winter, we discussed this, and how to get there. I hope the Perl 6 Patterns Hackathon will contribute significantly, and I also hope that in 30-60 years, we will look back and be happy about most of the choices made around this time! I truly believe that we can get there!&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Call for sponsor matching &lt;/h3&gt;In this spirit, Ingvoldstad IT decided to sponsor this hackathon with NOK 5,000 (≈ EUR 650), and I hereby call for other companies who develop software&lt;a href=&quot;http://howcaniexplainthis.blogspot.com/2012/04/oslopm-perl-6-patterns-hackathon-2012.html#note&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;*&lt;/a&gt; to match this amount. &lt;a href=&quot;http://oslo.pm.org/&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Oslo.pm&lt;/a&gt; will put those money to good use!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I hope to see you in Oslo in a week!&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;a name=&quot;note&quot; rel=&quot;nofollow&quot;&gt;&lt;/a&gt;* &lt;small&gt;&lt;i&gt;I did not write &quot;Perl&quot; here, because I think that is largely irrelevant. Perl 6 is an amalgam of many of the most interesting programming language features, and offers a very compelling path to those who want a next-generation language after the current versions of e.g. Perl, Python, and Ruby.&lt;/i&gt;&lt;/small&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/753668960778118906-132283182020413800?l=howcaniexplainthis.blogspot.com&quot; width=&quot;1&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>bakkushan</name>
			<uri>http://pipes.yahoo.com/pipes/pipe.info?_id=c30fa6b5be32693af535b6e46c4fabd6</uri>
		</author>
		<source>
			<title type="html">How Can I Explain This? - Perl 6</title>
			<subtitle type="html">Pipes Output</subtitle>
			<link rel="self" href="http://pipes.yahoo.com/pipes/pipe.run?_id=c30fa6b5be32693af535b6e46c4fabd6&amp;_render=rss"/>
			<id>http://pipes.yahoo.com/pipes/pipe.info?_id=c30fa6b5be32693af535b6e46c4fabd6</id>
		</source>
	</entry>

	<entry>
		<title type="html">Rakudo Hack: Dynamic Export Lists</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2012-rakudo-hack-dynamic-export-lists.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2012-rakudo-hack-dynamic-export-lists.html</id>
		<updated>2012-04-13T03:59:43+00:00</updated>
		<content type="html">&lt;p&gt;Rakudo's meta programming capabilities are very good when it comes to
objects, classes and methods. But sometimes people want to generate
subroutines on the fly and use them, and can't seem to find a way to do
it.&lt;/p&gt;

&lt;p&gt;The problem is that subroutines are usually stored (and looked up from) in
the lexical pad (ie the same as &lt;code&gt;my&lt;/code&gt;-variables), and those lexpads
are immutable at run time.&lt;/p&gt;

&lt;p&gt;Today I found a solution that lets you dynamically install subroutines with
a computed name into a module, and you can then &lt;code&gt;use&lt;/code&gt; that module
from elsewhere, and have all the generated subroutines available.&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;synStatement&quot;&gt;module&lt;/span&gt; A {
    &lt;span class=&quot;synPreProc&quot;&gt;BEGIN&lt;/span&gt; {
        &lt;span class=&quot;synSpecial&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$name&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;synSpecial&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$x&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; { &lt;span class=&quot;synIdentifier&quot;&gt;say&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;OH HAI from &amp;amp;foo&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt; }
                &lt;span class=&quot;synPreProc&quot;&gt;but&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;role&lt;/span&gt; { &lt;span class=&quot;synStatement&quot;&gt;method&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;name&lt;/span&gt; { &lt;span class=&quot;synIdentifier&quot;&gt;$name&lt;/span&gt; } }&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
        trait_mod&lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;gt;&lt;/span&gt;(&lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$x&lt;/span&gt;)&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
    }
}
&lt;/pre&gt;

&lt;p&gt;Inside the module first we need a &lt;code&gt;BEGIN&lt;/code&gt; block, so that the
&lt;code&gt;is export&lt;/code&gt; trait will run while the module is being compiled, and
thus knows which module to associate the subroutine to.&lt;/p&gt;

&lt;p&gt;Next comes the actual code object that is to be installed. Since the
&lt;code&gt;export&lt;/code&gt; trait inspects the name of the subroutine, we need to give
it one. Doing that dynamically can be done by overriding the &lt;code&gt;name&lt;/code&gt;
method, here by mixing in a role with such a method into the code object.&lt;/p&gt;

&lt;p&gt;Finally comes the part where the export trait is applied. The code here
uses knowledge of the calling conventions that hide behind a trait.&lt;/p&gt;

&lt;p&gt;A different script can then write&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;synPreProc&quot;&gt;use&lt;/span&gt; A&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
foo()&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;And access the dynamically exported sub just like any other.&lt;/p&gt;

&lt;p&gt;In future there will hopefully be much nicer APIs for this kind of
fiddling, but for now I'm glad that a workaround has been found.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Announce: Perlito version 9; Perl5 and Perl6 compilers by Flavio S. Glock</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/04/msg672.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/04/msg672.html</id>
		<updated>2012-04-11T05:55:46+00:00</updated>
		<content type="html">Perlito is a compiler collection that contains both a Perl 5 compiler&lt;br /&gt;(perlito5) and a Perl 6 compiler (perlito6):&lt;br /&gt;&lt;br /&gt;    - Perl5 to Javascript (browser and node.js)&lt;br /&gt;&lt;br /&gt;    - Perl6 to Javascript (browser and v8 command-line)&lt;br /&gt;    - Perl6 to Perl5 (v6.pm, runs in perl 5.8 and up)&lt;br /&gt;    - Perl6 to Python (Python 2.6 and 2.7)&lt;br /&gt;&lt;br /&gt;Run Perlito online, in the browser:&lt;br /&gt;&lt;br /&gt;        http://perlcabal.org/~fglock/perlito5.html&lt;br /&gt;        http://perlcabal.org/~fglock/perlito6.html&lt;br /&gt;&lt;br /&gt;From CPAN (perlito6 only):&lt;br /&gt;&lt;br /&gt;   http://search.cpan.org/dist/v6/lib/v6.pm&lt;br /&gt;&lt;br /&gt;   $ cpan v6&lt;br /&gt;&lt;br /&gt;Perlito is a work in progress. For the source code, to-do list, and bugs:&lt;br /&gt;&lt;br /&gt;    http://github.com/fglock/Perlito&lt;br /&gt;&lt;br /&gt;- Flavio S. Glock (fglock)&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 Hackathon in Oslo: Be Prepared!</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2012-hackathon-preparations.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2012-hackathon-preparations.html</id>
		<updated>2012-04-11T05:52:08+00:00</updated>
		<content type="html">&lt;p&gt;The Oslo Perl Mongers &lt;a href=&quot;https://gist.github.com/1711730&quot;&gt;invite to the Perl 6 Patterns
Hackathon in Oslo&lt;/a&gt;. I have &lt;a href=&quot;http://perlgeek.de/blog-en/perl-6/2012-upcoming-p6-hackathon.html&quot;&gt;previously
suggested that we hack on database connectivity&lt;/a&gt;, and so far only got
positive feedback. If you want to help, here is what you can do to be
prepared:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Get a github account&lt;/li&gt;
    &lt;li&gt;Build and install Rakudo&lt;/li&gt;
    &lt;li&gt;Build and install zavolaj/NativeCall&lt;/li&gt;
    &lt;li&gt;download MiniDBI&lt;/li&gt;
    &lt;li&gt;install and prepare databases to talk to&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To hack efficiently on those projects, and to benefit from last-minute
fixes, you should obtain Rakudo, NativeCall and MiniDBI from their git source
repositories -- that last release is already outdated.&lt;/p&gt;

&lt;p&gt;Here are the instructions in detail. If at any point you run into problems,
feel free to ask &lt;a href=&quot;http://perl6.org/community/irc&quot;&gt;on the #perl6 IRC
channel&lt;/a&gt; or the perl6-users@perl.org mailing list.&lt;/p&gt;

&lt;h2&gt;Get a Github account&lt;/h2&gt;

&lt;p&gt;All the interesting Perl 6 code lives in git repositories on &lt;a href=&quot;https://github.com/&quot;&gt;github&lt;/a&gt;. If you don't have an account already, &lt;a href=&quot;https://github.com/signup/free&quot;&gt;sign up -- it's free&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Build and install Rakudo&lt;/h2&gt;

&lt;p&gt;This step &lt;a href=&quot;http://rakudo.org/how-to-get-rakudo/&quot;&gt;is described well
    on the Rakudo homepage&lt;/a&gt;. Please follow the instruction in section
&quot;Building the compiler from source&quot;.&lt;/p&gt;

&lt;p&gt;For the following steps it is important that you have a fresh
&lt;code&gt;perl6&lt;/code&gt; executable file in your $PATH. If you have downloaded
rakudo to &lt;code&gt;/home/you/p6/rakudo/&lt;/code&gt;, you can run the command

&lt;/p&gt;&lt;pre&gt;PATH=$PATH:/home/you/p6/rakudo/install/bin
&lt;/pre&gt;

&lt;p&gt;(and put it in your ~/.bashrc file if you want it permanently available,
not just in this shell).&lt;/p&gt;

&lt;h2&gt;Build and install zavolaj/NativeCall&lt;/h2&gt;

&lt;p&gt;NativeCall.pm is the high-level interface for calling C functions from
Perl 6 code. Install it:&lt;/p&gt;

&lt;pre&gt;$ git clone git://github.com/jnthn/zavolaj.git
$ cd zavolaj
$ cp lib/NativeCall.pm6 ~/.perl6/lib/
&lt;/pre&gt;

&lt;p&gt;If you download and install &lt;a href=&quot;https://github.com/masak/ufo/&quot;&gt;ufo&lt;/a&gt;, you can use it create a
Makefile for zavolaj. Then you can also run &lt;code&gt;make test&lt;/code&gt;. On Linux it might not find the
test libraries (which is mostly harmless, because you usually call libraries
that are installed into your operating system, like those from mysql or
postgres). In this case you should run &lt;code&gt;LD_LIBRARY_PATH=. make
test&lt;/code&gt; instead.&lt;/p&gt;

&lt;h2&gt;Download MiniDBI&lt;/h2&gt;

&lt;p&gt;That's not hard at all:&lt;/p&gt;

&lt;pre&gt;$ git clone git://github.com/mberends/MiniDBI.git
&lt;/pre&gt;

&lt;h2&gt;Install and Prepare Databases&lt;/h2&gt;

&lt;p&gt;So far, MiniDBI has (somewhat limited) support for mysql and postgres.
Since it is always easiest to start from (at least somewhat) working code, I
strongly recommend that you install at least one of those database
engines.&lt;/p&gt;

&lt;p&gt;Most modern Linux systems allow an easy installation via the package
manager, and there are installers available for other operating systems. Be
sure to also install the headers or development files if they come as extra
packages.&lt;/p&gt;

&lt;h3&gt;Mysql&lt;/h3&gt;

&lt;p&gt;As mysql &lt;code&gt;root&lt;/code&gt; user, run these statements:&lt;/p&gt;

&lt;pre&gt;CREATE DATABASE zavolaj;
CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'testpass';
GRANT SELECT         ON   mysql.* TO 'testuser'@'localhost';
GRANT CREATE         ON zavolaj.* TO 'testuser'@'localhost';
GRANT DROP           ON zavolaj.* TO 'testuser'@'localhost';
GRANT INSERT         ON zavolaj.* TO 'testuser'@'localhost';
GRANT DELETE         ON zavolaj.* TO 'testuser'@'localhost';
GRANT LOCK TABLES    ON zavolaj.* TO 'testuser'@'localhost';
GRANT SELECT         ON zavolaj.* TO 'testuser'@'localhost';
&lt;/pre&gt;

&lt;h3&gt;Postgres&lt;/h3&gt;

&lt;p&gt;Launch &lt;code&gt;psql&lt;/code&gt; as the &lt;code&gt;postgres&lt;/code&gt; user and run these
statements:&lt;/p&gt;

&lt;pre&gt;CREATE DATABASE zavolaj;
CREATE ROLE testuser LOGIN PASSWORD 'testpass';
GRANT ALL PRIVILEGES ON DATABASE zavolaj TO testuser;
&lt;/pre&gt;

&lt;p&gt;You should now be able to connect with:&lt;/p&gt;

&lt;pre&gt;psql --host=localhost --dbname=zavolaj --username=testuser --password
&lt;/pre&gt;

&lt;p&gt;(psql will ask you for the password. Enter &lt;code&gt;testpass&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;Other Databases&lt;/h3&gt;

&lt;p&gt;If you want to work on a backend for another database, it helps to have
that database installed. &lt;a href=&quot;http://sqlite.org/&quot;&gt;Sqlite&lt;/a&gt; is
an obvious choice (easy to install, zero setup), but of course there are
other free database too, like &lt;a href=&quot;http://firebirdsql.org/&amp;amp;quot&quot;&gt;firebird&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Project ideas&lt;/h2&gt;

&lt;p&gt;There is a lot of stuff to do. What follows is only a loose, incomplete
collection of ideas.&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Fix the postgres backend to actually pass its tests&lt;/li&gt;
    &lt;li&gt;Both mysql and postgres backends don't implement placeholders
    properly; change them (or one of them) to pass the placeholder values out
    of band.&lt;/li&gt;
    &lt;li&gt;Write an sqlite backend&lt;/li&gt;
    &lt;li&gt;Currently the user builds a DSN (&quot;data source name&quot;) string out of the
    driver name, database name, db host name and so on, and then the driver
    parses it again. One could change that to pass all the information as
    named parameters instead.&lt;/li&gt;
    &lt;li&gt;Improve test coverage. For example test that numbers round-trip with
    the correct types.&lt;/li&gt;
    &lt;li&gt;Write a small application that uses a database. That's the best way to
    see if MiniDBI and the backends work.&lt;/li&gt;
&lt;/ul&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Plans for the Perl 6 Hackathon in Oslo</title>
		<link href="http://ttjjss.wordpress.com/2012/04/10/plans-for-the-perl-6-hackathon-in-oslo/"/>
		<id>http://ttjjss.wordpress.com/?p=153</id>
		<updated>2012-04-10T20:20:10+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;The &lt;a href=&quot;https://gist.github.com/1711730&quot; title=&quot;Perl 6 Patterns&quot;&gt;Perl 6 Patterns hackthon in Oslo&lt;/a&gt; is happening next week, gathering most of the Rakudo developers. Awesome!&lt;/p&gt;
&lt;p&gt;I’m still looking for the thing I’d like to work on during the event. The first obvious thought is &lt;a href=&quot;https://github.com/tadzik/bailador&quot; title=&quot;Bailador on Github&quot;&gt;Bailador&lt;/a&gt;, the Perl 6 port of &lt;a href=&quot;http://perldancer.org/&quot; title=&quot;Perl Dancer&quot;&gt;Dancer&lt;/a&gt; web framework. It’s getting more and more in shape, and I’ve recently started looking through the code of Dancer 2 to see how it all &lt;em&gt;should&lt;/em&gt; be done. I really don’t want Bailador to share a fate of &lt;a href=&quot;https://github.com/tadzik/neutro&quot; title=&quot;Neutro on Github&quot;&gt;neutro&lt;/a&gt; (ie reaching a state of being a horrible, unmaintainable mess), and I feel that it’s time for it to be refactored a bit. It came to life as a 10-line module written on a piece of paper during my Spanish classes, and simply adding more and more features to it is not going to end well.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perlgeek.de/blog-en/perl-6/2012-upcoming-p6-hackathon.html&quot; title=&quot;Moritz's blog&quot;&gt;Moritz Lenz is planning to hack on database stuff&lt;/a&gt;, which combined with a useful and usable web framework could create a nice platform for web development in Perl 6. I’ve already heard people saying “well, I could write Perl 6 apps if it had a web framework and some database access”, so I guess it’s time to show off something suitable for web development, even simple, but usable and covering most usage scenarios.&lt;/p&gt;
&lt;p&gt;While we’re at the Web-y stuff, one thing that we really miss is a good (or at least good-enough) templating engine. Bailador has been using &lt;a href=&quot;https://github.com/tadzik/Bailador/blob/master/lib/Ratel.pm&quot; title=&quot;Ratel on Github&quot;&gt;Ratel&lt;/a&gt; for some time, yet for one it stopped working on Rakudo recently (it was probably relying on some buggy or incorrect behaviour), and it suffers the problem of having no maintainer (no one really claims ownership of it). &lt;a href=&quot;https://github.com/masak/web/tree/master/lib/Hitomi&quot; title=&quot;Hitomi on Github&quot;&gt;Hitomi&lt;/a&gt; was to be a templating engine for the new age, so maybe it’s about time to bring it back to life in all its glory? One could definitely find something to hack on.&lt;/p&gt;
&lt;p&gt;From the new things, but still related to web development, &lt;a href=&quot;http://perlalchemy.blogspot.com/&quot; title=&quot;Zby's blog&quot;&gt;zby&lt;/a&gt; has proposed porting &lt;a href=&quot;https://github.com/zby/WebNano&quot; title=&quot;WebNano on Github&quot;&gt;WebNano&lt;/a&gt; to Perl 6 as one of the hackathon projects. It’s not something very big, and it should be totally possible to rewrite it in Perl 6 to run on Rakudo.&lt;/p&gt;
&lt;p&gt;Or maybe there is something you particulary want to see in Perl 6? I’m sure we’ll not lack people with tuits; what is there that could possibly make Perl 6 a useful tool for you, something that you were missing when you last looked at it?&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/ttjjss.wordpress.com/153/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/ttjjss.wordpress.com/153/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/ttjjss.wordpress.com/153/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/ttjjss.wordpress.com/153/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/ttjjss.wordpress.com/153/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/ttjjss.wordpress.com/153/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/ttjjss.wordpress.com/153/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/ttjjss.wordpress.com/153/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/ttjjss.wordpress.com/153/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/ttjjss.wordpress.com/153/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/ttjjss.wordpress.com/153/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/ttjjss.wordpress.com/153/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/ttjjss.wordpress.com/153/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/ttjjss.wordpress.com/153/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=ttjjss.wordpress.com&amp;amp;blog=15099040&amp;amp;post=153&amp;amp;subd=ttjjss&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>ttjjss</name>
			<uri>http://ttjjss.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Whatever but Cool » Perl</title>
			<link rel="self" href="http://ttjjss.wordpress.com/category/perl/feed/"/>
			<id>http://ttjjss.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Back from vacation, hackathon coming up!</title>
		<link href="http://6guts.wordpress.com/2012/04/05/back-from-vacation-hackathon-coming-up/"/>
		<id>http://6guts.wordpress.com/?p=203</id>
		<updated>2012-04-05T15:56:48+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;So, I’m back from vacation. Turns out Argentina is a pretty awesome place to vacation in, too. As well as wonderful food and delicious imperial stout (amongst other good beers), there was walking like this…&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://6guts.files.wordpress.com/2012/04/bp-11.jpg&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;wp-image-207 aligncenter&quot; height=&quot;414&quot; src=&quot;http://6guts.files.wordpress.com/2012/04/bp-11.jpg?w=553&amp;amp;h=414&quot; title=&quot;bp-1&quot; width=&quot;553&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;…and other cool stuff, like glaciers…&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://6guts.files.wordpress.com/2012/04/bp-2.jpg&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter  wp-image-208&quot; height=&quot;414&quot; src=&quot;http://6guts.files.wordpress.com/2012/04/bp-2.jpg?w=554&amp;amp;h=414&quot; title=&quot;bp-2&quot; width=&quot;554&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
…and so even though the laptop came with me, it was just too much fun to be outside, especially when the weather was good so much of the time. I did sneak in a few patches, though, most notably implementing PRE and POST phasers.&lt;/p&gt;
&lt;p&gt;Anyway, I’m safely back, after an 8 hour flight delay from Buenos Aires and a small bus accident at Frankfurt airport. Yes, this airport fails SO hard they managed to screw up the 2 minute bus trip from the plane to the terminal…anyway, I got off with just a few small cuts. Suggest taking the train to YAPC::Europe this summer… :-)&lt;/p&gt;
&lt;p&gt;So, what’s coming up? Well, this month brings a &lt;a href=&quot;https://gist.github.com/1711730&quot;&gt;Perl 6 hackathon in Oslo&lt;/a&gt;, where I look forward to being together with a bunch of other Rakudo and Perl 6 folks. I’m sure we’ll get some nice stuff done, and some future directions worked out. I’m happy that one of the most industrious Perl Mongers groups I know when it comes to organizing such events is also set in a very pleasant city situated in a beautiful country. :-) By the way, it’s still very possible (and very encouraged) to sign up if you want to come along.&lt;/p&gt;
&lt;p&gt;As moritz++ noted on rakudo.org, we’re &lt;a href=&quot;http://rakudo.org/2012/04/05/no-rakudo-star-release-for-march-2012-stay-tuned-for-april/&quot;&gt;skipping doing a distribution (Star) release&lt;/a&gt; based on the March compiler release since an unfortunate bug slipped in that busted precompilation of modules that used NativeCall. We hold ourselves to higher standards of stability in the distribution releases (which are user focused) than the compiler ones (which just ship at the same time each month), and this would have been too big a regression. The good news is that I’ve patched the bug today, so we’re now all clear for doing an April one – and what a nice release it should be.&lt;/p&gt;
&lt;p&gt;Well, time for dinner here – which I’ll be having with masak++. No doubt macros will come up, and what’s needed to get us along to the next level with those. Stay tuned; the next month should be interesting in Rakudo land. :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/203/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/6guts.wordpress.com/203/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/6guts.wordpress.com/203/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/6guts.wordpress.com/203/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/6guts.wordpress.com/203/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/6guts.wordpress.com/203/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/6guts.wordpress.com/203/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/6guts.wordpress.com/203/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/6guts.wordpress.com/203/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/6guts.wordpress.com/203/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/6guts.wordpress.com/203/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/6guts.wordpress.com/203/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/6guts.wordpress.com/203/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/6guts.wordpress.com/203/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=6guts.wordpress.com&amp;amp;blog=14597269&amp;amp;post=203&amp;amp;subd=6guts&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://6guts.wordpress.com</uri>
		</author>
		<source>
			<title type="html">6guts</title>
			<subtitle type="html">Tales of Perl 6 guts hacking</subtitle>
			<link rel="self" href="http://6guts.wordpress.com/feed/"/>
			<id>http://6guts.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">No Rakudo Star release for March 2012, stay tuned for April</title>
		<link href="http://rakudo.org/2012/04/05/no-rakudo-star-release-for-march-2012-stay-tuned-for-april/"/>
		<id>http://rakudo.org/?p=124</id>
		<updated>2012-04-05T08:13:10+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Some of our users have asked what happened to the Rakudo Star release that was planned for March 2012. The short answer is that it didn’t happen.&lt;/p&gt;
&lt;p&gt;The long answer is that compiler release for March 2012 include &lt;a href=&quot;http://6guts.wordpress.com/2012/03/09/meta-programming-slides-and-some-rakudo-news/&quot;&gt;“bounded serialization”, a technique that drastically reduces startup time&lt;/a&gt;. Unfortunately it also causes a regression that stops the calling of C functions under cetain conditions.&lt;/p&gt;
&lt;p&gt;We have noticed that too late, and decided not to base a Star distribution release on the new compiler release. We hope to fix the regression in time for the April release.&lt;/p&gt;
&lt;p&gt;So if everything goes as planned, the April release of Rakudo star will have greatly reduced startup time, many new compiler features and the newly fixed modules &lt;a href=&quot;https://github.com/ihrd/uri/&quot;&gt;URI&lt;/a&gt; and &lt;a href=&quot;https://github.com/cosimo/perl6-lwp-simple/&quot;&gt;LWP::Simple&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We also hope to get some more cool stuff done at the &lt;a href=&quot;https://gist.github.com/1711730&quot;&gt;Perl 6 Patterns Hackathon in Oslo&lt;/a&gt;, maybe &lt;a href=&quot;http://perlgeek.de/blog-en/perl-6/2012-upcoming-p6-hackathon.html&quot;&gt;improved database access&lt;/a&gt;.&lt;/p&gt;</content>
		<author>
			<name>moritz</name>
			<uri>http://rakudo.org</uri>
		</author>
		<source>
			<title type="html">rakudo.org</title>
			<subtitle type="html">Rakudo Perl 6</subtitle>
			<link rel="self" href="http://rakudo.org/feed/"/>
			<id>http://rakudo.org</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Asynchronous HTTP requests in Perl 6</title>
		<link href="http://ttjjss.wordpress.com/2012/04/02/asynchronous-http-in-perl-6/"/>
		<id>http://ttjjss.wordpress.com/?p=147</id>
		<updated>2012-04-02T15:38:43+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Inspired by &lt;a href=&quot;http://oylenshpeegul.typepad.com/blog/2012/03/asynchronicity.html,&quot;&gt;http://oylenshpeegul.typepad.com/blog/2012/03/asynchronicity.html&lt;/a&gt;, I decided to tackle asynchronous  HTTP requests in Perl 6 on Rakudo. Allowing this required a bit of hacking on &lt;a href=&quot;https://github.com/tadzik/MuEvent&quot; title=&quot;MuEvent on Github&quot;&gt;MuEvent&lt;/a&gt;, and the changes are far too ugly and hacky to be released, but here’s how it looks:&lt;/p&gt;
&lt;pre&gt;    use MuEvent;

    my @urls = &amp;lt;
        cpan.org
        kosciol-spaghetti.pl
        perlcabal.org
        duckduckgo.com
        perl6.org
    &amp;gt;;
    my $count = @urls.elems;
    my $starttime;

    sub handler ($what, $content) {
        say sprintf &quot;%-25s has loaded in %s&quot;, $what, now - $starttime;
        unless --$count {
            say &quot;Finished in {now - $starttime} seconds&quot;;
            exit 0;
        }
    }

    for @urls -&amp;gt; $url {
        http_get(url =&amp;gt; $url, cb =&amp;gt; sub { handler($url, $^content) })
    }

    $starttime = now;

    MuEvent::run;&lt;/pre&gt;
&lt;p&gt;The code results in something like this:&lt;/p&gt;
&lt;pre&gt;    cpan.org                  has loaded in 0.047303409195493
    perlcabal.org             has loaded in 0.0985883954326499
    duckduckgo.com            has loaded in 0.137316369015216
    perl6.org                 has loaded in 0.175586713955562
    kosciol-spaghetti.pl      has loaded in 0.413971411974607
    Finished in 0.465130828044337 seconds&lt;/pre&gt;
&lt;p&gt;You may notice that the urls are pretty much ordered – that’s because my internet connection is probably way faster than MuEvent’s event loop :)&lt;/p&gt;
&lt;p&gt;For now &lt;code&gt;http_get()&lt;/code&gt; is using bare sockets to send HTTP requests, which is, well, Less Than Awesome at least. Once I figure out how to properly tie &lt;a href=&quot;https://github.com/cosimo/perl6-lwp-simple/&quot; title=&quot;LWP::Simple on Github&quot;&gt;LWP::Simple&lt;/a&gt; to MuEvent I’ll hopefully hack out some proper solution to be released for everyone’s joy. Stay tuned.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/ttjjss.wordpress.com/147/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/ttjjss.wordpress.com/147/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/ttjjss.wordpress.com/147/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/ttjjss.wordpress.com/147/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/ttjjss.wordpress.com/147/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/ttjjss.wordpress.com/147/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/ttjjss.wordpress.com/147/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/ttjjss.wordpress.com/147/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/ttjjss.wordpress.com/147/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/ttjjss.wordpress.com/147/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/ttjjss.wordpress.com/147/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/ttjjss.wordpress.com/147/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/ttjjss.wordpress.com/147/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/ttjjss.wordpress.com/147/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=ttjjss.wordpress.com&amp;amp;blog=15099040&amp;amp;post=147&amp;amp;subd=ttjjss&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>ttjjss</name>
			<uri>http://ttjjss.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Whatever but Cool » Perl</title>
			<link rel="self" href="http://ttjjss.wordpress.com/category/perl/feed/"/>
			<id>http://ttjjss.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">Announce: Niecza Perl 6 v16 by Stefan O'Rear</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/03/msg671.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/03/msg671.html</id>
		<updated>2012-03-26T23:21:55+00:00</updated>
		<content type="html">&lt;br /&gt;    Announce: Niecza Perl 6 v16&lt;br /&gt;&lt;br /&gt;This is the sixteenth release of Niecza Perl 6, as usual scheduled on&lt;br /&gt;the last Monday of the month.&lt;br /&gt;&lt;br /&gt;You can obtain a build of Niecza from [1].  This build contains a&lt;br /&gt;working compiler as a set of .exe and .dll files suitable for use with&lt;br /&gt;Mono or Microsoft .NET.  If you wish to follow latest developments,&lt;br /&gt;you can obtain the source from [2]; however, you will still need a&lt;br /&gt;binary for bootstrapping, so you gain nothing from a &quot;source is&lt;br /&gt;better&quot; perspective.&lt;br /&gt;&lt;br /&gt;Niecza is a Perl 6 compiler project studying questions about the&lt;br /&gt;efficient implementability of Perl 6 features.  It currently targets&lt;br /&gt;the Common Language Runtime; both Mono and Microsoft .NET are known to&lt;br /&gt;work.  On Windows, Cygwin is required for source builds only; see the&lt;br /&gt;README for details.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    List of changes&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Minor changes]&lt;br /&gt;&lt;br /&gt;Improved multi-dispatch failure error messages (Larry Wall).&lt;br /&gt;&lt;br /&gt;Added @foo[1;2;3] multi-indexing syntax (but no real multidimensional&lt;br /&gt;arrays yet), and Zen slices @foo[].&lt;br /&gt;&lt;br /&gt;Added take-rw and return-rw functions for returning a read-write value.&lt;br /&gt;(This will allow you to futureproof your code against take and return&lt;br /&gt;becoming readonly by default.)&lt;br /&gt;&lt;br /&gt;Containers bound into aggregates like %foo&amp;lt;k&amp;gt; := 1..3 now retain list&lt;br /&gt;nature for iteration.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Getting involved&lt;br /&gt;&lt;br /&gt;Contact sorear in irc.freenode.net #perl6 or via the sender address of&lt;br /&gt;this mailing.  Also check out the TODO file; whether you want to work&lt;br /&gt;on stuff on it, or have cool ideas to add to it, both are good.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[1] https://github.com/downloads/sorear/niecza/niecza-16.zip&lt;br /&gt;[2] https://github.com/sorear/niecza&lt;br /&gt;&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Counting t4 configurations</title>
		<link href="http://strangelyconsistent.org/blog/counting-t4-configurations"/>
		<id>tag:strangelyconsistent.org,2012-03-25:blog/counting-t4-configurations</id>
		<updated>2012-03-25T13:37:54+00:00</updated>
		<content type="html">&lt;p&gt;&lt;img src=&quot;http://strangelyconsistent.org/blog/images/ko-lanta-beach.jpg&quot; style=&quot;display: block; margin-left: auto; margin-right: auto; padding: 1em;&quot; title=&quot;Photo by prilfish, http://www.flickr.com/photos/silkebaron/2573215246/&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I discovered the t4 task in a beach paradise on the island Ko Lanta in
Thailand. I was there with friends, having a long-awaited December vacation,
away from dreary Swedish cold and dark and snow. Instead, we were enjoying
sun and shade, cool drinks on the beach or the quiet of our air-conditioned
condo, getting caught up with reading, talking amongst ourselves, and exploring
our surroundings. We seemed to have gotten there just a few weeks before the
normal wave of tourism, so we felt uniquely at peace and at ease.&lt;/p&gt;

&lt;p&gt;One day I was playing around with my Android phone, looking for some game to
distract me in this oddly tranquil place. Since I'm ever fascinated with games
on hexagonal grids, I searched for &quot;hex&quot;. And I found this hex-grid-based
one-player puzzle game that had me instantly hooked.&lt;/p&gt;

&lt;p&gt;The easiest way to understand the t4 task is probably to &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.tiny.hexslide1kandroid&quot;&gt;play the
game&lt;/a&gt;,
and actually drag some pieces around.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://strangelyconsistent.org/blog/images/hex-slide-app.jpg&quot; style=&quot;display: block; margin-left: auto; margin-right: auto; padding: 1em;&quot; title=&quot;Hex Slide 1,000 by Tiny Bite Games, LLC&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The description of t4 merely captures in formal writing what the puzzle game
shows plainly:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;This problem makes use of a board of hexagonal cells that looks like this:

      i1  i2  i3  i4  i5
    j1  j2  j3  j4  j5  j6
      k1  k2  k3  k4  k5
    l1  l2  l3  l4  l5  l6
      m1  m2  m3  m4  m5
    n1  n2  n3  n4  n5  n6
      o1  o2  o3  o4  o5

Each cell has up to six neighbors. l3 has neighbors (clockwise) k3, l4, m3,
m2, l2, and k2.

The board is populated with some number of straight pieces of length 2 and 3.
Pieces never overlap, but they can move in the direction of their length,
which we will refer to as a &quot;groove&quot;. So for example, a piece that starts out
on locations l1 and l2 can &quot;slide&quot; over to rest on locations l5 and l6.
No valid move can make a piece leave the groove in which it was first found.

We write &quot;groove&quot; because &quot;row&quot; doesn't quite capture how the pieces can be
situated. Besides the above seven rows of the table, a groove (and thus the
pieces in it) can also run along a diagonal direction, like this:

      e1  d1  c1  b1  a1
    f1  e2  d2  c2  b2  a2
      f2  e3  d3  c3  b3
    g1  f3  e4  d4  c4  b4
      g2  f4  e5  d5  c5
    h1  g3  f5  e6  d6  c6
      h2  g4  f6  e7  d7

Or a groove and its pieces could run along the other diagonal direction:

      p2  q4  r6  s7  t7
    p1  q3  r5  s6  t6  u6
      q2  r4  s5  t5  u5
    q1  r3  s4  t4  u4  v4
      r2  s3  t3  u3  v3
    r1  s2  t2  u2  v2  w2
      s1  t1  u1  v1  w1

There are a total of 23 grooves on the board, 7 horizontal, and 8 for
each diagonal. Grooves vary in length from 2 (out in the corners) to
7 (around the main diagonals).
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The t4 description goes on for some time, but I'll stop there for now, because
this post doesn't consider the dynamic aspects of the puzzle, only the board
configurations.&lt;/p&gt;

&lt;p&gt;Parenthetically, figuring out a decent coordinate system for the board, which
manages to encode the fact that the grooves constrain the pieces, and the way
each location on the board is the intersection of (exactly) three grooves, took
me somewhere between hours and days of thinking. I was a bit disappointed to
have to make that part public (in order to rein in the solutions enough and to
be able to write base tests for the task). Looking at the solutions sent in,
I don't think many people appreciated how much one can actually get for free
with this particular encoding.&lt;/p&gt;

&lt;p&gt;The t4 task is to write an algorithm that gets one special piece from one side
of the board to another. Sometimes other pieces will block its way, and will
have to be moved away first. And so on, recursively. The &quot;and so on&quot; bit is
what makes this an interesting problem.&lt;/p&gt;

&lt;p&gt;My attention quickly focused on more basic matters, though.&lt;/p&gt;

&lt;p&gt;The app on my Android phone sports a thousand distinct puzzles. Presumably the
good people at &lt;a href=&quot;http://tinybitegames.com/&quot;&gt;Tiny Bite Games&lt;/a&gt; generated these
algorithmically somehow. Some of these are on slightly different boards, but
I've chosen to ignore those for the purposes of t4. There's also a non-free
version with ten thousand puzzles.&lt;/p&gt;

&lt;p&gt;How many puzzles are there?&lt;/p&gt;

&lt;p&gt;Or, to be precise, how many board configurations are there? By &quot;board
configuration&quot;, I mean every legal way to strew pieces on the board, everything
from leaving the board empty to completely filling it up with length-2 and
length-3 pieces. All of them.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://strangelyconsistent.org/blog/images/3x1-confs.png&quot; style=&quot;display: block; margin-left: auto; margin-right: auto; padding: 1em;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As we headed out from Ko Lanta, I tried to upper-bound this, with just pen and
paper, just multiplying out all the ways to place length-2 and length-3 pieces
in all the grooves but without accounting for collisions. I arrived at a
ridiculous number of combinations: about 3e57. I looked out the window of the
taxi-jeep and saw my first real-life elephant. It looked small in comparison.&lt;/p&gt;

&lt;p&gt;Now, &quot;all possible board configurations&quot; isn't the only number that might
interest us here. It's just the &quot;universe&quot; of objects that we're dealing with
in t4. As days and weeks went by (and I eventually got back home from
vacation), finding the exact number of configurations became a worthy
challenge, a Mount Everest of sorts.&lt;/p&gt;

&lt;p&gt;But there are other, smaller numbers, which are also interesting:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The number of configurations with a piece l12. (&quot;start-configurations&quot;)&lt;/li&gt;
&lt;li&gt;The number of configurations with a piece l12 &lt;em&gt;and no other l-groove piece&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;The number of solvable start-configurations.&lt;/li&gt;
&lt;li&gt;The number of trivially solvable start-configurations (where the solution is
simply &lt;code&gt;l[12 -&amp;gt; 56]&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But I didn't want to attack these problems until I had felled the beast.
Finding the number of all possible configurations, the size of the problem
space, the extent of the universe. Which was hopefully a lot smaller than 3e57.&lt;/p&gt;

&lt;p&gt;Here's one way to solve it, in pseudocode:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Set confs &amp;lt;- 0
For all combinations of piece placements
    If there are no forbidden overlaps
        Set confs &amp;lt;- confs + 1
Output confs
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It's a wonderfully simple program to think up. And it only has one loop in it.
Let's say we happen to have an unbelievably fast computer at hand, which runs
the loop in an optimized way so that each iteration takes a nanosecond on
average. That's faster than today's computers, for sure.&lt;/p&gt;

&lt;p&gt;Yeah, so. You run that on your fast computer, and I'll go brew some coffee.
See you in nine and a half million million million million million million
years.&lt;/p&gt;

&lt;p&gt;So, that clearly wouldn't work. The program was simple to implement, but it
just wouldn't terminate before our physical universe did. Basically, if you
have to loop over ~3e57 things, you're screwed.&lt;/p&gt;

&lt;p&gt;I needed something that could intelligently weed out impossible branches as it
went along, that didn't make the stack or the RAM blow up. Come to think of it,
something a little like the &lt;a href=&quot;http://en.wikipedia.org/wiki/Dancing_Links&quot;&gt;Dancing
Links&lt;/a&gt; algorithm, which computes
solutions to &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Exact_cover&quot;&gt;exact cover&lt;/a&gt;&quot;-type
problems quickly (considering), and in constant space.&lt;/p&gt;

&lt;p&gt;Conveniently, I had written a DLX solver in 2011. In C, no less (for speed).
The idea with that project, which was only partly realized, is to make it very
easy to specify problems in some &quot;human&quot; representation, and then frontends and
backends to the solver would take care of the translation.&lt;/p&gt;

&lt;p&gt;Of course, the board configuration enumeration problem wasn't an exact cover
problem, I knew that. It would be if I was only interested in all the possible
ways to fill up the board completely with length-2 and length-3 pieces. (There
are 11,071,306 such configurations. Because I knew you were wondering.) But I
didn't want that, I wanted board configurations with &quot;gaps&quot; in them too.
(Especially since these are the only ones that can actually be solved!) But I
figured I could extract the &quot;essence&quot; of the DLX algorithm, which is to be
clever about possible alternatives at each choice point.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://strangelyconsistent.org/blog/images/7x5-exact-cover.png&quot; style=&quot;display: block; margin-left: auto; margin-right: auto; padding: 1em;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After a week of trying and failing to write an algorithm that borrowed the
&quot;essence&quot; of the DLX algorithm, I came to an embarrassing realization.&lt;/p&gt;

&lt;p&gt;The problem I wanted to solve &lt;em&gt;is&lt;/em&gt; an exact cover problem. It can be solved
directly using the DLX code I already had.&lt;/p&gt;

&lt;p&gt;It was the word &quot;gaps&quot; that had me confused. Exact cover problems are
characterized by the fact that their solutions have no overlaps, and no gaps.
(That's what the &quot;exact&quot; in &quot;exact cover&quot; means.) But, fine, let's replace the
word &quot;gap&quot; by the word &quot;marshmallow&quot;. Now, what I was looking for was all the
possible ways to fill the board with length-2 pieces, length-3 pieces, and
marshmallows. Voilà, exact cover problem.&lt;/p&gt;

&lt;p&gt;Some problems are made solvable simply by restating them. Also, don't
underestimate the power of reifying nothingness.&lt;/p&gt;

&lt;p&gt;So, I fed a representation of the problem into my DLX solver. It ran for two
weeks on a decent computer, enumerating millions of configurations a second. It
came up with this answer:&lt;/p&gt;

&lt;p&gt;There are 4,783,154,184,978 board configurations. A bit short of five million
million. Graah, I felled the beast!&lt;/p&gt;

&lt;p&gt;Before this long calculation was even finished, it had occurred to me that (1),
(2) and (4) on my list were &lt;em&gt;also&lt;/em&gt; describable as exact cover problems. Only
(3) is tricky and requires actually making moves on the board. But the other
three questions can be formulated as exact cover problems by changing the shape
of the board, essentially &quot;forbidding&quot; either one groove to occupy a location,
or forbidding the location outright.&lt;/p&gt;

&lt;p&gt;I started generating such exact cover models with a &lt;a href=&quot;http://gist.github.com/2189078&quot;&gt;100-line Perl 6
script&lt;/a&gt;. The numbers that fell out were these:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;There are 573,538,221,334 configurations with a piece l12.&lt;/li&gt;
&lt;li&gt;There are 375,873,151,406 configurations with a piece l12 and no other l-groove pieces.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;The number of solvable start configurations is still unknown as of this writing.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;There are 7,767,954,496 trivially solvable configurations.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At least now it doesn't feel unlikely at all that some game company manages to
generate ten thousand hex puzzles.&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Parrot 4.2.0 &quot;Ornithopter&quot; Released! by Jonathan &quot;Duke&quot; Leto</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/03/msg670.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/03/msg670.html</id>
		<updated>2012-03-24T00:11:25+00:00</updated>
		<content type="html">&quot;Technology, in common with many other activities, tends toward avoidance of&lt;br /&gt;risks by investors. Uncertainty is ruled out if possible. Capital investment&lt;br /&gt;follows this rule, since people generally prefer the predictable. Few recognize&lt;br /&gt;how destructive this can be, how it imposes severe limits on variability and&lt;br /&gt;thus makes whole populations fatally vulnerable to the shocking ways our&lt;br /&gt;universe can throw the dice.&quot;&lt;br /&gt;    -- Assessment of Ix, Bene Gesserit Archives (Heretics of Dune)&lt;br /&gt;&lt;br /&gt;On behalf of the Parrot team, I'm proud to announce Parrot 4.2.0, also known&lt;br /&gt;as &quot;Ornithopter&quot;.  Parrot (http://parrot.org) is a virtual machine designed&lt;br /&gt;to run all dynamic languages.&lt;br /&gt;&lt;br /&gt;Parrot 4.2.0 is available on Parrot's FTP site&lt;br /&gt;(ftp://ftp.parrot.org/pub/parrot/releases/devel/4.2.0/), or by following the&lt;br /&gt;download instructions at http://parrot.org/download.  For those who would like&lt;br /&gt;to develop on Parrot, or help develop Parrot itself, we recommend using Git to&lt;br /&gt;retrieve the source code to get the latest and best Parrot code.&lt;br /&gt;&lt;br /&gt;Parrot 4.2.0 News:&lt;br /&gt;    - API Changes&lt;br /&gt;        + The signature of getprop was changed from (PMC,String,PMC) to&lt;br /&gt;          (PMC, PMC,String) for consistency&lt;br /&gt;    - Core&lt;br /&gt;        + Parrot Calling Conventions (pcc) now reuses Continuation PMCs&lt;br /&gt;          internally, which reduces GC work by 25% and improves&lt;br /&gt;          the fib.pir benchmark by 6%&lt;br /&gt;        + Winxed snapshot updated to 1.6.devel 44a04cfa7b&lt;br /&gt;        + Improved the detection of Clang-ish compilers during configuration&lt;br /&gt;        + Fixed a possible segfault bug when reading packfiles with no&lt;br /&gt;         constants or main_sub&lt;br /&gt;        + By default, Parrot has now elevated these GCC warnings to errors&lt;br /&gt;          during compile time:&lt;br /&gt;            implicit-function-declaration, undef, missing-braces,&lt;br /&gt;            nested externs, old-style-definition, strict-prototypes,&lt;br /&gt;        + The OS Dynamic PMC now has separate functions to unlink a file&lt;br /&gt;          and remove an empty directory (rmdir)&lt;br /&gt;        + Fix building on Cygwin due to an improperly named DLL file&lt;br /&gt;        + Various small bug fixes pointed out by static and dynamic analysis&lt;br /&gt;          tools&lt;br /&gt;    - Branches&lt;br /&gt;        + Work on M0 continues now in the m0 branch, which contains both&lt;br /&gt;          implementations (currently C and Perl) and specification.&lt;br /&gt;        + Good progress has been made on the threads branch which builds&lt;br /&gt;          on the green_threads branch. This gets Parrot much closer to&lt;br /&gt;          being able to utilize multiple CPU cores seemlessly. More details&lt;br /&gt;          at http://niner.name/Hybrid_Threads_for_the_Parrot_VM.pdf&lt;br /&gt;    - Documentation&lt;br /&gt;        + New release manager documentation for parrot.github.com :&lt;br /&gt;            http://git.io/parrot-github-guide&lt;br /&gt;    - Community&lt;br /&gt;        + Parrot was accepted to Google Summer of Code 2012!&lt;br /&gt;          Ideas Page: http://git.io/parrot-gsoc-2012&lt;br /&gt;&lt;br /&gt;The SHA256 message digests for the downloadable tarballs are:&lt;br /&gt;&lt;br /&gt;a960c89f94099c9643c5623263bdb7fa9e97effb889c975382bbf9c0251186b4&lt;br /&gt;parrot-4.2.0.tar.bz2&lt;br /&gt;69ee93d9f81babcff67b747cc614358958a32f274e407b65771ca5a056d4c3d4&lt;br /&gt;parrot-4.2.0.tar.gz&lt;br /&gt;&lt;br /&gt;Many thanks to all Parrot contributors for making this possible, and our&lt;br /&gt;sponsors for supporting this project. This release is comprised of 136 commits&lt;br /&gt;on the master branch since 4.1.0, with contributions from : Andy Lester, Vasily&lt;br /&gt;Chekalkin, Jonathan &quot;Duke&quot; Leto, jkeenan, Alvis Yardley Whiteknight, Brian&lt;br /&gt;Gernhardt, Gerhard R, NotFound, Francois Perrad, Moritz Lenz and luben.&lt;br /&gt;&lt;br /&gt;Our next scheduled release is 17 April 2012.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;br /&gt;-- &lt;br /&gt;Jonathan &quot;Duke&quot; Leto &amp;lt;jonathan@leto.net&amp;gt;&lt;br /&gt;Leto Labs LLC&lt;br /&gt;209.691.DUKE // http://labs.leto.net&lt;br /&gt;NOTE: Personal email is only checked twice a day at 10am/2pm PST,&lt;br /&gt;please call/text for time-sensitive matters.&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Upcoming Perl 6 Hackathon in Oslo, Norway</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2012-upcoming-p6-hackathon.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2012-upcoming-p6-hackathon.html</id>
		<updated>2012-03-21T01:15:52+00:00</updated>
		<content type="html">&lt;p&gt;The Oslo Perl Mongers are &lt;a href=&quot;https://gist.github.com/1711730&quot;&gt;inviting to the Perl 6 Patterns
Hackathon in Oslo&lt;/a&gt; in one month, and I very much look forward to being
there.&lt;/p&gt;

&lt;p&gt;Hackathons can be quite fun and productive if many programmers focus on the
same goal. So to make the hackathon a success, I'm willing to work on whatever
we decide to set as our goal(s).&lt;/p&gt;

&lt;p&gt;One topic that is dear to me, and that is approachable by a horde of
programmers (and guided by one or two Rakudo core hackers) is bringing
database access into a usable state.&lt;/p&gt;

&lt;p&gt;With &lt;a href=&quot;http://6guts.wordpress.com/2012/01/29/this-months-rakudo-star-release-and-whats-coming-next/&quot;&gt;muchly
    improved support for calling C functions&lt;/a&gt; and &lt;a href=&quot;https://github.com/jnthn/zavolaj/&quot;&gt;NativeCall.pm&lt;/a&gt; we should have
enough infrastructure for access mysql, postgres and SQLite databases. &lt;a href=&quot;https://github.com/mberends/MiniDBI&quot;&gt;MiniDBI&lt;/a&gt; aims to provide some
basic convenience, but currently only the mysql driver partially works.&lt;/p&gt;

&lt;p&gt;I believe that with concentrated effort, MiniDBI and the rest of the
infrastructure can be improved to the point that it is usable, and other
modules can start to rely on it. Databases usable in Perl 6, doesn't that
sound good?&lt;/p&gt;

&lt;p&gt;I'll see what kind of feedback I get on this idea, and if it's positive,
I'll follow up with instructions on how to install the prerequisites for
hacking on MiniDBI and its drivers.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html">t3: Addition chains</title>
		<link href="http://strangelyconsistent.org/blog/t3-addition-chains"/>
		<id>tag:strangelyconsistent.org,2012-03-14:blog/t3-addition-chains</id>
		<updated>2012-03-14T21:24:00+00:00</updated>
		<content type="html">&lt;div style=&quot;background: #ded; margin: 1em; padding: 1em;&quot;&gt;&lt;code&gt;&amp;lt;arnsholt&amp;gt; Heh. NP-complete problems in a
competition. That's just mean ^_^&lt;/code&gt;&lt;/div&gt;

&lt;p&gt;Ok, we're in the midst of reviewing &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;Perl 6 Coding Contest
2011&lt;/a&gt;
code submissions, and the turn has come to the third task: addition chains.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;For a positive integer N, an addition chain for N is a sequence
starting with 1, each subsequent element being the sum of two
earlier elements (possibly the sum of the same element twice),
and ending with N.

For example for N = 9, this is a possible addition chain:

    (1, 2, 4, 5, 8, 9)

because 2 = 1 + 1, 4 = 2 + 2, 5 = 1 + 4, etc.

But a minimal solution would be:

    (1, 2, 3, 6, 9)

Write a program that reads numbers N from standard input, one per line,
and outputs a minimal addition chain like the one above.

Sometimes there will be several possible solutions of minimal length.
That's fine; just pick one of them.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Addition chains are interesting from a computing standpoint, because of a
multiplication technique called &lt;a href=&quot;http://en.wikipedia.org/wiki/Addition-chain_exponentiation&quot;&gt;addition-chain
exponentiation&lt;/a&gt;,
by which you can use an addition chain for a certain &lt;code&gt;N&lt;/code&gt; to do a minimum
number of multiplications; the addition chain implicitly encodes a sequence of
multiplications to perform. So there's a genuine interest in finding shortest
addition chains.&lt;/p&gt;

&lt;p&gt;This is a hard problem. Finding addition chains is easy, but finding a
&lt;em&gt;minimal&lt;/em&gt; addition chain is not. Depsite arnsholt's quote above, it hasn't
been &lt;em&gt;proven&lt;/em&gt; NP-complete. Slightly more general problems have, but not this
exact one. We know it's tricky, though.&lt;/p&gt;

&lt;p&gt;Wikipedia has this to say about &lt;a href=&quot;http://en.wikipedia.org/wiki/Addition_chain#Methods_for_computing_addition_chains&quot;&gt;the
problem&lt;/a&gt;:
&quot;There is no known algorithm which can calculate a minimal addition chain for
a given number with any guarantees of reasonable timing or small memory
usage.&quot; That's what we're looking for in this contest: problems that are easy
to state, and that look quite straightforward, but that have hidden depth.&lt;/p&gt;

&lt;p&gt;Someone may look at the problem and think &quot;aha! dynamic programming!&quot; —
but, alas, as Wikipedia patiently explains:&lt;/p&gt;

&lt;div style=&quot;background: #ded; margin: 1em; padding: 1em;&quot;&gt;&lt;p&gt;Note that the problem of finding the shortest addition
chain cannot be solved by &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_programming&quot;&gt;dynamic
programming&lt;/a&gt;, because it
does not satisfy the assumption of &lt;a href=&quot;http://en.wikipedia.org/wiki/Optimal_substructure&quot;&gt;optimal
substructure&lt;/a&gt;. That is, it
is not sufficient to decompose the power into smaller powers, each of which is
computed minimally, since the addition chains for the smaller powers may be
related (to share computations). For example, in the shortest addition chain
for &lt;i&gt;a&lt;sup&gt;15&lt;/sup&gt;&lt;/i&gt; [...] the subproblem for &lt;i&gt;a&lt;sup&gt;6&lt;/sup&gt;&lt;/i&gt; must
be computed as &lt;i&gt;(a&lt;sup&gt;3&lt;/sup&gt;)&lt;sup&gt;2&lt;/sup&gt;&lt;/i&gt; since &lt;i&gt;a&lt;sup&gt;3&lt;/sup&gt;&lt;/i&gt;
is re-used (as opposed to, say, &lt;i&gt;a&lt;sup&gt;6&lt;/sup&gt; =
a&lt;sup&gt;2&lt;/sup&gt;(a&lt;sup&gt;2&lt;/sup&gt;)&lt;sup&gt;2&lt;/sup&gt;&lt;/i&gt;, which also requires three
multiplies).&lt;/p&gt;&lt;/div&gt;

&lt;p&gt;This is probably why the problem looks approachable, because it sort of feels
like a dynamic-programming problem. But it ain't.&lt;/p&gt;

&lt;p&gt;People sent in solutions. &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/&quot;&gt;Go check them
out&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I was a bit concerned that people might find &lt;a href=&quot;http://www-cs-faculty.stanford.edu/~uno/programs/achain0.w&quot;&gt;Knuth's
solution&lt;/a&gt;
and just transcribe it into Perl 6. (Which would've been OK, if a bit boring
if everyone did it.) But no-one did that; instead, people started from
well-known algorithms, either
&lt;a href=&quot;http://en.wikipedia.org/wiki/Breadth-first_search&quot;&gt;breadth-first&lt;/a&gt; or
&lt;a href=&quot;http://en.wikipedia.org/wiki/Depth-first_search&quot;&gt;depth-first&lt;/a&gt; search.&lt;/p&gt;

&lt;p&gt;Perhaps the most remarkable things that can be recounted about the solutions
are the cases where they deviate from correctness in various ways. One solution
produced the right results for the first 76 chain lengths, but with &lt;code&gt;N = 77&lt;/code&gt;,
it went awry due to internal optimizations which turned out to be less than
innocent. (The first rule of optimization? &quot;Make sure you don't get caught.&quot;)&lt;/p&gt;

&lt;p&gt;Then there were two submitted algorithms that generated Brauer chains. &quot;What's
a Brauer chain?&quot;, I hear you asking. Hold on tight and I'll tell you. A Brauer
chain is an addition chain where each new element is formed as the sum of the
&lt;em&gt;previous&lt;/em&gt; element and some element (possibly the same). Thus, of the two
examples from the description,&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(1, 2, 4, 5, 8, 9)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(1, 2, 3, 6, 9)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The latter is a Brauer chain, but the former isn't, because you can't get 8 by
summing 5 and some element in the chain.&lt;/p&gt;

&lt;p&gt;The task is to generate minimal addition chains. If some algorithm looks only
among the Brauer chains, will it ever omit some shorter chain from its search?
The answer, it turns out, highlights exactly why I like mathematics.&lt;/p&gt;

&lt;p&gt;A Brauer-based algorithm will fail the first time at &lt;code&gt;N = 12509&lt;/code&gt;. (See &lt;a href=&quot;http://books.google.se/books?id=1AP2CEGxTkgC&amp;amp;pg=PA169&amp;amp;lpg=PA169&amp;amp;dq=brauer+chain+12509&amp;amp;source=bl&amp;amp;ots=TjkugXGNnE&amp;amp;sig=wsVTOZ0OVyFruRFnpqgInngdUaw&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=XrhgT_HbBqjj4QSC0NXTDg&amp;amp;ved=0CB4Q6AEwAA#v=onepage&amp;amp;q=brauer%20chain%2012509&amp;amp;f=false&quot;&gt;this
reference&lt;/a&gt;,
provided by hakank++).&lt;/p&gt;

&lt;p&gt;Now, you might of course argue that failing at &lt;code&gt;N = 77&lt;/code&gt; is more wrong than
failing at &lt;code&gt;N = 12509&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Sheldon: &lt;em&gt;More&lt;/em&gt; wrong? &quot;Wrong&quot; is an absolute state and not subject to gradation.&lt;/p&gt;

&lt;p&gt;Stuart: Of course it is! It's a little wrong to say a tomato is a vegetable. It's very wrong to say it's a suspension bridge.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;More precisely, there are infinitely many &lt;code&gt;N&lt;/code&gt; for which no Brauer chain is
minimal. 12509 just happens to be the smallest one.&lt;/p&gt;

&lt;p&gt;This task, understandably, is a tricky one to judge. We've tried to go easy on
the contestants (and non-contestants) in the reviews. After all, the problem
&lt;em&gt;is&lt;/em&gt; hard.&lt;/p&gt;

&lt;p&gt;Now, who wants to translate Knuth's solution to Perl 6? 哈哈&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">mjd’s magic z</title>
		<link href="http://justrakudoit.wordpress.com/2012/03/13/mjds-magic-z/"/>
		<id>http://justrakudoit.wordpress.com/?p=403</id>
		<updated>2012-03-13T15:23:04+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;So, I plunged ahead and implemented &lt;a href=&quot;http://perl.plover.com/classes/cftalk/TALK/slide027.html&quot;&gt;mjd’s &lt;code&gt;z&lt;/code&gt; function&lt;/a&gt; in Perl 6.  This is the first simple step to full continued fraction arithmetic, allowing addition with a rational, multiplication by a rational, and taking the reciprocal of a continued fraction.  (And oh!  I just accidentally discovered that I’d missed a bunch of slides at the end of mjd’s talk which discuss implementing the full &lt;code&gt;z&lt;/code&gt; function from HAKMEM!)&lt;/p&gt;
&lt;p&gt;The implementation turned out to be pretty straightforward, with only the edge cases causing trouble.  &lt;code&gt;z&lt;/code&gt; maintains its state using four variables, &lt;code&gt;$a&lt;/code&gt;, &lt;code&gt;$b&lt;/code&gt;, &lt;code&gt;$c&lt;/code&gt;, and &lt;code&gt;$d&lt;/code&gt;.  There are two basic operations which modify this state: &lt;a href=&quot;http://perl.plover.com/classes/cftalk/TALK/slide028.html&quot;&gt;input&lt;/a&gt;, which takes the next value from the continued fraction provided, and &lt;a href=&quot;http://perl.plover.com/classes/cftalk/TALK/slide029.html&quot;&gt;output&lt;/a&gt;, which outputs the next value of the continued fraction result.  How do you know which to do?  Easy! If &lt;code&gt;$a div $c == $b div $d&lt;/code&gt;, then we’ve determined the next value which can be output, and should output it.  If not, then we need to input another value.&lt;/p&gt;
&lt;p&gt;The tricky bits: first, it’s completely legal for &lt;code&gt;$c&lt;/code&gt; and/or &lt;code&gt;$d&lt;/code&gt; to be &lt;code&gt;0&lt;/code&gt;.  That causes a division by zero error in Niecza.  So I added a check for each, setting the result of the division to &lt;code&gt;Inf&lt;/code&gt; when it needs to be.  The second thing is what happens when the given continued fraction runs out of values.  In that case, the next value is implicitly &lt;code&gt;Inf&lt;/code&gt;.  That’s well and good, but &lt;a href=&quot;http://perl.plover.com/classes/cftalk/TALK/slide034.html&quot;&gt;mjd somehow performs magic with it&lt;/a&gt;.  I don’t understand what the heck he was doing there, but I can imitate the result.  Here it all is in one function:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;sub z($a is copy, $b is copy, $c is copy, $d is copy, @x) {
    gather loop {
        my $a-div-c = $c ?? $a div $c !! Inf;
        my $b-div-d = $d ?? $b div $d !! Inf;
        last if $a-div-c == Inf &amp;amp;&amp;amp; $b-div-d == Inf;
        if $a-div-c == $b-div-d {
            my $n = $a-div-c;
            ($a, $b, $c, $d) = ($c, $d, $a - $c * $n, $b - $d * $n);
            take $n;
        } else {
            if @x {
                my $p = @x.shift;
                ($a, $b, $c, $d) = ($b, $a + $b * $p, $d, $c + $d * $p);
            } else {
                ($a, $b, $c, $d) = ($b, $b, $d, $d); # WHY????
            }
        }
    }
}
&lt;/pre&gt;&lt;br /&gt;
And there you have it!  I’m still a bit worried about the edge cases (I haven’t tested negative numbers yet, for instance), but I think it clearly points the way onto the full HAKMEM &lt;code&gt;z&lt;/code&gt; function.&lt;p&gt;&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/justrakudoit.wordpress.com/403/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/justrakudoit.wordpress.com/403/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/justrakudoit.wordpress.com/403/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/justrakudoit.wordpress.com/403/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/justrakudoit.wordpress.com/403/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/justrakudoit.wordpress.com/403/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/justrakudoit.wordpress.com/403/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/justrakudoit.wordpress.com/403/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/justrakudoit.wordpress.com/403/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/justrakudoit.wordpress.com/403/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/justrakudoit.wordpress.com/403/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/justrakudoit.wordpress.com/403/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/justrakudoit.wordpress.com/403/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/justrakudoit.wordpress.com/403/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=justrakudoit.wordpress.com&amp;amp;blog=12219098&amp;amp;post=403&amp;amp;subd=justrakudoit&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>colomon</name>
			<uri>http://justrakudoit.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Just Rakudo It</title>
			<subtitle type="html">I Never Metaop I Didn't Like</subtitle>
			<link rel="self" href="http://justrakudoit.wordpress.com/feed/"/>
			<id>http://justrakudoit.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Continued Fractions</title>
		<link href="http://justrakudoit.wordpress.com/2012/03/13/continued-fractions/"/>
		<id>http://justrakudoit.wordpress.com/?p=399</id>
		<updated>2012-03-13T00:23:42+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Four months ago I created &lt;a href=&quot;https://github.com/colomon/Math-ContinuedFractions&quot;&gt;Math::ContinuedFractions&lt;/a&gt; on Github.  But I didn’t actually post any code to it.  But I’ve finally started, pushing &lt;a href=&quot;https://github.com/colomon/Math-ContinuedFractions/blob/master/t/00-experiments.t&quot;&gt;t/00-experiments.t&lt;/a&gt;.  It’s very simple so far, but that’s because I’m slowly feeling my way through this unfamiliar subject.&lt;/p&gt;
&lt;p&gt;I tried to link the Wikipedia equation graphic for a continued fraction, but that just lost me the first draft of this post, so instead I’ll link to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Continued_fraction&quot;&gt;Wikipedia page&lt;/a&gt;.  It is the source of our first algorithm, for converting a number to a continued fraction:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;sub make-continued-fraction (Real $x is copy) {
    gather loop {
        my $a = $x.floor;
        take $a;
        $x = $x - $a;
        last if $x == 0;
        $x = 1 / $x;
    }
}
&lt;/pre&gt; &lt;p&gt;&lt;/p&gt;
&lt;p&gt;This returns the components of the continued fraction as a lazy list.  It passes the first few simple tests I’ve thrown at it, but I’m a bit worried about &lt;code&gt;$x = 1 / $x&lt;/code&gt;.  Should this maybe be &lt;code&gt;FatRat&lt;/code&gt; math instead of normal math?  I’m not clear on the implications one way or the other.&lt;/p&gt;
&lt;p&gt;Unfortunately, the Wikipedia page doesn’t shed any light on how to do basic arithmetic on continued fractions.  HAKMEM gives a complete overview on &lt;a href=&quot;http://www.inwap.com/pdp10/hbaker/hakmem/cf.html#item101b&quot;&gt;basic continued fraction arithmetic&lt;/a&gt;, but I find it quite hard going.  MJD has a nifty &lt;a href=&quot;http://perl.plover.com/classes/cftalk/TALK/&quot;&gt;talk on the subject&lt;/a&gt;, including some algorithms I hope to implement soon.  Unfortunately, he doesn’t get into the tricky stuff. &lt;/p&gt;
&lt;p&gt;Luther Tychonievich has a &lt;a href=&quot;http://www.cs.virginia.edu/~lat7h/blog/posts/7.html&quot;&gt;nice blog post&lt;/a&gt; on the subject which brings up a problem I have not seen mentioned elsewhere.  Some pretty basic operations may not work because they need every  (infinite) input term to determine the first output term.  His example is squaring the square root of 2.  As I understand it, the problem is that the first term (the integer part) flits back and forth between 1 and 2 as each addition term is fed to the code.  It can never settle down on one or the other.&lt;/p&gt;
&lt;p&gt;Incidentally, my code fails miserably in Rakudo, but works in Niecza.  Unfortunately for this project, Niecza cannot currently handle overloading the arithmetic operators for a new type, which means I’ll have to figure out how to get things working on Rakudo at some point.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/justrakudoit.wordpress.com/399/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/justrakudoit.wordpress.com/399/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/justrakudoit.wordpress.com/399/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/justrakudoit.wordpress.com/399/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/justrakudoit.wordpress.com/399/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/justrakudoit.wordpress.com/399/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/justrakudoit.wordpress.com/399/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/justrakudoit.wordpress.com/399/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/justrakudoit.wordpress.com/399/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/justrakudoit.wordpress.com/399/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/justrakudoit.wordpress.com/399/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/justrakudoit.wordpress.com/399/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/justrakudoit.wordpress.com/399/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/justrakudoit.wordpress.com/399/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=justrakudoit.wordpress.com&amp;amp;blog=12219098&amp;amp;post=399&amp;amp;subd=justrakudoit&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>colomon</name>
			<uri>http://justrakudoit.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Just Rakudo It</title>
			<subtitle type="html">I Never Metaop I Didn't Like</subtitle>
			<link rel="self" href="http://justrakudoit.wordpress.com/feed/"/>
			<id>http://justrakudoit.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">Macros progress report: D1 merged</title>
		<link href="http://strangelyconsistent.org/blog/macros-progress-report-d1-merged"/>
		<id>tag:strangelyconsistent.org,2012-03-10:blog/macros-progress-report-d1-merged</id>
		<updated>2012-03-10T16:14:00+00:00</updated>
		<content type="html">&lt;p&gt;I've merged my first chunk of work, known to the &lt;a href=&quot;http://news.perlfoundation.org/2011/09/hague-grant-application-implem.html&quot;&gt;grant application&lt;/a&gt; as &quot;D1&quot;, into the &lt;code&gt;nom&lt;/code&gt; branch of Rakudo. Concretely, this means three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The next release of Rakudo (release #50, due 2012-03-22) will be the first release of any Perl 6 implementation to feature AST macros.&lt;/li&gt;
&lt;li&gt;People who have a new-enough revision of the &lt;code&gt;nom&lt;/code&gt; branch checked out can play around with basic macros already.&lt;/li&gt;
&lt;li&gt;There's just three chunks of work left to do. &lt;code&gt;:-)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The work has progressed nicely so far. It's been a little trickier than I expected, but not insurmountable yet, and I've received plenty of support from jnthn++. The time estimates were way too optimistic, it turned out — partly because the grant took a while to get accepted, partly because  &lt;code&gt;$dayjob&lt;/code&gt; keeps wanting tuits — but at least I'm not stuck.&lt;/p&gt;

&lt;p&gt;One interesting aspect of the grant that I didn't expect is that much of my thinking happens in gists. Increasingly, I'm beginning to see gists as a sort of &quot;semi-private blog posts&quot;. They're notes mainly left for myself and my creative process, and they don't clutter up the blog feed, but they're there if people are interested enough to see how sausage is made. I don't go back and &quot;fix&quot; gists when I learn new things that contradict what's in them — I just write new ones.&lt;/p&gt;

&lt;p&gt;Here, just for reference, I collect all the gists I've made so far philosophizing on macros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/1148915&quot;&gt;Musings on macros&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/1149126&quot;&gt;Macros and short-circuiting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/1156662&quot;&gt;More thoughts on macros&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;(at this point, I wrote the &lt;a href=&quot;http://news.perlfoundation.org/2011/09/hague-grant-application-implem.html&quot;&gt;grant application&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/1293853&quot;&gt;D4, deconstructed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/1548053&quot;&gt;I'm thinking about macros again&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/1809356&quot;&gt;Cool use for a macro: meta for&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/1853560&quot;&gt;The lifetime of a macro invocation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I have one more gist coming up that I haven't written yet, about how macro-argument AST thingies are thunkish and rebind to their outer context just like closures do.&lt;/p&gt;

&lt;p&gt;The other &quot;artifacts&quot; that have fallen out of the grant work so far, are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;a href=&quot;https://github.com/perl6/roast/blob/7bbd58b13e8cd7c692ad8d6730159b311b8dedd3/S06-macros/macros-d1.t&quot;&gt;spectest file&lt;/a&gt;. Too few tests in it, even though I've tested everything I can think of. There will be more tests for D2, I'm sure.&lt;/li&gt;
&lt;li&gt;A &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/e29b2f18665dd3bd5aa31692317f64713d789a7a&quot;&gt;monolithic commit&lt;/a&gt; to Rakudo, representing my D1 work. I did a bunch of rebase operations on the way to keep current with the &lt;code&gt;nom&lt;/code&gt; branch, and each time I folded a number of commits into a single one, because I considered most commits after the original one from September to be &quot;oh right&quot;-type afterthoughts. Not sure how this rhymes with jnthn's &lt;a href=&quot;http://blog.edument.se/2012/03/09/love-your-version-history-and-itll-love-you-back/&quot;&gt;post about atomic commits&lt;/a&gt;... I'm a bit divided on the issue.&lt;/li&gt;
&lt;li&gt;A talk, at &lt;a href=&quot;http://conferences.yapceurope.org/gpw2012/&quot;&gt;Deutscher Perl Workshop&lt;/a&gt; in Erlangen. You can &lt;a href=&quot;http://masak.org/carl/gpw-2012-macros/talk.pdf&quot;&gt;see the slides here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Looking ahead a bit, what's up next is D2. Informally, D2 consists of &quot;getting those little &lt;code&gt;{{{$stuff}}}&lt;/code&gt; thingies to work&quot;. We need a way to represent &quot;there's a placeholder here&quot; in the AST, because that's how the ASTs look during the static part of their lifetime (before macro application). It will require a new AST type. As it happens, PAST in nqp/Rakudo is just about to be replaced by the next generation of AST technology, and &lt;a href=&quot;http://6guts.wordpress.com/2012/03/09/meta-programming-slides-and-some-rakudo-news/&quot;&gt;jnthn++ is just about to start working on that&lt;/a&gt;. So it makes sense for me to assist him, since I'm now blocking the new AST technology landing in Rakudo for my macros work. Aside from blocking, I expect D2 to be quite easy to implement.&lt;/p&gt;

&lt;p&gt;See you again at the next milestone. And possibly at part-way resting stops in between.&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Meta-programming slides, and some Rakudo news</title>
		<link href="http://6guts.wordpress.com/2012/03/09/meta-programming-slides-and-some-rakudo-news/"/>
		<id>http://6guts.wordpress.com/?p=200</id>
		<updated>2012-03-09T00:19:59+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;I’m just back from a trip to the German Perl Workshop. Of course, the food was great and the beer was greater. :-) I was also very happy to see various Rakudo hackers in person; moritz++ was one of the organizers, and tadzik++ attended and gave a talk also. Much fun was had, and some hacking happened too. :-)&lt;/p&gt;
&lt;p&gt;You may be interested to check out the &lt;a href=&quot;http://jnthn.net/papers/2012-gpw-meta-programming.pdf&quot;&gt;slides from my talk on meta-programming in Perl 6&lt;/a&gt;. It covers some of the things we’ve been able to do for a while, as well as having a new example that shows off an interesting use of bounded serialization in combination with meta-programming. Also, I have now submitted this talk to the French Perl Workshop, which will take place in June. :-)&lt;/p&gt;
&lt;p&gt;As for Rakudo progress, here’s some of the things that have been going on.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The bounded serialization branch has landed (and thus will be in the next release)! This has, as hoped, greatly decreased Rakudo’s startup time – an improvement that has been welcomed by a bunch of folks on #perl6. Module and setting pre-compilation is now also faster, along with loading of pre-compiled modules. Win all around.&lt;/li&gt;
&lt;li&gt;Thanks to the serialization, various things have been unblocked. Amongst them, the constant declarator now takes non-literals on its RHS, and the BEGIN and CHECK phasers now work in r-value context. In both cases, the values are serialized if these things are done in a pre-compiled module.&lt;/li&gt;
&lt;li&gt;masak++ merged his initial work on macros. While there’s much more to do in this area yet, it’s great that we now have the basics in place, enabling declarations of macros and quasis. I’m sure masak will blog about this soon – keep a lookout for it.&lt;/li&gt;
&lt;li&gt;tadzik++ has got us some support for the Set, Bag, KeySet and KeyBag types.&lt;/li&gt;
&lt;li&gt;moritz++ cleaned up match handling, and also implemented the :exhaustive and :nth match adverbs. So, that’s two out of three branches mentioned in my last post landed. :-)&lt;/li&gt;
&lt;li&gt;Stunning progress on phasers! We now support ENTER, LEAVE, KEEP, UNDO and START. The LEAVE, KEEP and UNDO drew very heavily on work by mls++. Additionally, FIRST, NEXT and LAST are supported inside for loops (though not yet available in other loops). I’m fairly fired up to do PRE and POST too, though need some spec clarifications first.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;moritz++ has also been continuing his excellent typed exceptions work; we discussed how to handle typed exceptions in the metamodel during the workshop, which should extend their reach to cover even more of the errors that can crop up.&lt;/p&gt;
&lt;p&gt;So, all in all, lots of progress, and we’ve still just under two weeks to go until the March release. Having landed the bounded serialization work, I’ve been enjoying doing some feature development; right now, I have a branch that is muchly cleaning up name handling, improving name interpolation and getting various of the missing pseudo-packages in place. I expect to have this work completed in time to go in to the release also.&lt;/p&gt;
&lt;p&gt;Beyond that, it’ll be time for me to dig back into some of the fundamentals again. Most immediately, that will be getting QRegex to be the engine we use to parse NQP and Perl 6 code (currently, we use QRegex for compiling the regexes and grammars you write in your Perl 6 programs, but still use the previous generation engine for parsing Perl 6 source). This will allow us to eliminate a vast swathe of Parrot PIR code that we depend on (the new regex compiler is written in NQP), aiding portability. I aim to land this in time for the April release; I’ve already done significant pieces of the work towards it.&lt;/p&gt;
&lt;p&gt;Probably somewhat in parallel with that (though set to land after it), I’ll also be taking on our AST and AST compiler. This work will see it being ported from PIR to NQP, switched over to use 6model objects (which means we can use natively typed attributes to make the nodes more memory efficient, and also serialize the nodes as macros require) and given much better handling of native types. Generally I’m hoping for compilation performance improvements and better code generation. This will also eliminate our last large PIR dependency, thus clearing the final hurdle for making a real stab at targeting an extra backend.&lt;/p&gt;
&lt;p&gt;One slight slowdown will be that I’m taking a vacation during the second half of March. I’m going to a land far away, and plan to spend most of my time seeing it, and checking out their food and drink. The laptop is coming, though, so it won’t be a complete stop; my stress levels are happily in fairly good shape right now, so I don’t need my vacation to be a complete break with normality, just a refreshing change of scene. :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/200/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/6guts.wordpress.com/200/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/6guts.wordpress.com/200/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/6guts.wordpress.com/200/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/6guts.wordpress.com/200/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/6guts.wordpress.com/200/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/6guts.wordpress.com/200/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/6guts.wordpress.com/200/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/6guts.wordpress.com/200/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/6guts.wordpress.com/200/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/6guts.wordpress.com/200/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/6guts.wordpress.com/200/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/6guts.wordpress.com/200/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/6guts.wordpress.com/200/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=6guts.wordpress.com&amp;amp;blog=14597269&amp;amp;post=200&amp;amp;subd=6guts&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://6guts.wordpress.com</uri>
		</author>
		<source>
			<title type="html">6guts</title>
			<subtitle type="html">Tales of Perl 6 guts hacking</subtitle>
			<link rel="self" href="http://6guts.wordpress.com/feed/"/>
			<id>http://6guts.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Rakudo Star 2012.02 out – and the focus for 2012.03</title>
		<link href="http://6guts.wordpress.com/2012/02/29/rakudo-star-2012-02-out-and-the-focus-for-2012-03/"/>
		<id>http://6guts.wordpress.com/?p=195</id>
		<updated>2012-02-29T00:21:00+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;I’ve just cut the &lt;a href=&quot;http://rakudo.org/2012/02/28/rakudo-star-2012-02-released/&quot;&gt;February 2012 release of Rakudo Star&lt;/a&gt;. The good news is that we got a bunch of nice improvements into the release.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;More typed exceptions, and better backtraces. This work has been done by moritz++; I’ll simply point you to his &lt;a href=&quot;http://perlgeek.de/blog-en/perl-6/2011-02-exceptions.html&quot;&gt;excellent blog post&lt;/a&gt; on that topic today. I think everyone working with Rakudo will appreciate the new backtraces, which cut out a lot of the uninformative details and are thus much more focused.&lt;/li&gt;
&lt;li&gt;FatRat is now implemented. This type gives you rational number support with big integer semantics for both the numerator and denominator. The Rat type now correctly degrades to a Num if the denominator gets too large, as per spec (this avoids performance issues in certain cases). Again, we’ve moritz++ to thank for this.&lt;/li&gt;
&lt;li&gt;We have object hashes! You can now make a declaration like:&lt;br /&gt;
my %hash{Any};&lt;br /&gt;
Which will have keys of type Any. You can constrain this as you wish. You can also still constrain the value in the usual way:&lt;br /&gt;
my Int %hash{Any};&lt;br /&gt;
This latter example gives you a hash with Int values and object keys, meaning that keys are not coerced to strings, as is the default. Thus, using %hash.keys will give you back the original objects. Identify is done based on .WHICH and thus ObjAt.&lt;/li&gt;
&lt;li&gt;The coercion syntax, Int($foo), is now implemented. This gives you another – perhaps neater – way to write $foo.Int, but types may also implemented the method postcircumfix:&amp;lt;( )&amp;gt; if the target type is the one that knows how to do the coercion.&lt;/li&gt;
&lt;li&gt;The reduction meta-operator used to have crazy bad performance, and parsed dodgy in some cases. Both of these issues are now resolved; it’s an order of magnitude faster and parses more correctly.&lt;/li&gt;
&lt;li&gt;Various regex improvements and more problems caught at compile time, which I discussed in my &lt;a href=&quot;http://6guts.wordpress.com/2012/02/10/bounded-serialization-better-regexes-and-better-errors/&quot;&gt;previous post&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As always, there’s a bunch of bug fixes and other tweaks – see the Rakudo ChangeLog for more details.&lt;/p&gt;
&lt;p&gt;Naturally, one release done simply means another one to work towards. :-) If you’ve been following along with my posts, you’ll have noticed that the bounded serialization work I’ve been doing didn’t make it in to the 2012.02 release; it just wasn’t done in time. The good news is that it’s well on course to land in very good time for the 2012.03 release.&lt;/p&gt;
&lt;p&gt;Today I got to the milestone of having a Rakudo binary, with a serialized CORE.setting, that will compile Test.pm and attempt the spectests. There’s a bunch of failures (which I expected), but a lot more passes than fails. Anyway, that means things are essentially working and I’m into triage mode. I’ve also got some very preliminary data on what kind of improvements it brings.&lt;/p&gt;
&lt;p&gt;Just from trying it out, I could feel that startup was faster, as hoped. tadzik++ built the bounded serialization branch and the current main development branch and compared the time they took for a simple “hello world” (such a simple program that startup cost will dominate). The result: the bounded serialization branch ran it in around 25% of the time. I think we can squeeze a bit more out yet, but achieving startup in a quarter of the time we do today is a big improvement. Loading time for pre-compiled modules will see a similar improvement.&lt;/p&gt;
&lt;p&gt;I also checked memory consumption when compiling CORE.setting. The bounded serialization branch uses 60% of the memory that the main development branch uses. I’d been hoping that this work would cut memory usage by around a third, and it’s done at least that. I didn’t measure the speedup for this task yet; while the other bits are fair comparisons, this one would not be yet even if I had a figure, since the optimizer is currently disabled (one of the transformations causes issues; I’m not expecting it to be a huge pain to resolve, but was more focused on the critical path to running spectests again so I could understand the fallout better).&lt;/p&gt;
&lt;p&gt;Once the busted spectests are running again, I’ll get this merged, then dig in to exploiting some of the opportunities it makes available. I’m hoping we can get some more nice features in place for the next release also; moritz++ has already got branches for sink context and the :exhaustive modifier in regexes in progress, and I’ve got some ideas of things to hack on… :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/195/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/6guts.wordpress.com/195/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/6guts.wordpress.com/195/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/6guts.wordpress.com/195/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/6guts.wordpress.com/195/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/6guts.wordpress.com/195/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/6guts.wordpress.com/195/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/6guts.wordpress.com/195/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/6guts.wordpress.com/195/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/6guts.wordpress.com/195/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/6guts.wordpress.com/195/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/6guts.wordpress.com/195/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/6guts.wordpress.com/195/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/6guts.wordpress.com/195/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=6guts.wordpress.com&amp;amp;blog=14597269&amp;amp;post=195&amp;amp;subd=6guts&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://6guts.wordpress.com</uri>
		</author>
		<source>
			<title type="html">6guts</title>
			<subtitle type="html">Tales of Perl 6 guts hacking</subtitle>
			<link rel="self" href="http://6guts.wordpress.com/feed/"/>
			<id>http://6guts.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Rakudo Star 2012.02 released</title>
		<link href="http://rakudo.org/2012/02/28/rakudo-star-2012-02-released/"/>
		<id>http://rakudo.org/?p=121</id>
		<updated>2012-02-28T23:26:39+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;On behalf of the Rakudo and Perl 6 development teams, I’m happy to announce the February 2012 release of “Rakudo Star”, a useful and usable distribution of Perl 6.  The tarball for the February 2012 release is available from &amp;lt;&lt;a href=&quot;http://github.com/rakudo/star/downloads&quot;&gt;http://github.com/rakudo/star/downloads&lt;/a&gt;&amp;gt;.&lt;/p&gt;
&lt;p&gt;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 #49 of the Rakudo Perl 6 compiler [1], version 4.1 of the Parrot Virtual Machine [2], and various modules, documentation, and other resources collected from the Perl 6 community.&lt;/p&gt;
&lt;p&gt;Here are some of the major improvements in this release over the previous distribution release.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The FatRat type is implemented, and Rat arithmetic now properly defaults to Num if the denominator is too big&lt;/li&gt;
&lt;li&gt;Object hashes are implemented, and can be declared with the syntax my %h{Any} (for a hash with keys of type Any)&lt;/li&gt;
&lt;li&gt;The &amp;lt;Some::Grammar::rulename&amp;gt; syntax is now implemented in regexes; &amp;lt;foo&amp;gt; can also be used to call predeclared lexical rules&lt;/li&gt;
&lt;li&gt;The Int($x) coercion syntax is implemented&lt;/li&gt;
&lt;li&gt;&amp;amp;rename and &amp;amp;copy are now implemented&lt;/li&gt;
&lt;li&gt;Improvements to the reduction meta-operator (order of magnitude faster, some parsing issues fixed)&lt;/li&gt;
&lt;li&gt;The &amp;lt;prior&amp;gt; regex built-in is now available, and matches whatever the last successful match matched&lt;/li&gt;
&lt;li&gt;A $match.make(…) method is available to set the AST for a match object not stored in the $/ variable&lt;/li&gt;
&lt;li&gt;Improved backtraces&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This release also contains a range of bug fixes, improvements to error reporting and better failure modes. Many more exceptions are thrown as typed exceptions.&lt;/p&gt;
&lt;p&gt;Due to continued evolution of and convergence with the Perl 6 spec, there are some changes to existing functionality that may affect your code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You may no longer use the $.x form in submethods and attribute initializers, as per spec; use the non-virtual $!x instead.&lt;/li&gt;
&lt;li&gt;The LHS of the xx operator is now thunked&lt;/li&gt;
&lt;li&gt;.conjugate is now called .conj&lt;/li&gt;
&lt;li&gt;Enumeration values .gist to just the key, not the full name&lt;/li&gt;
&lt;li&gt;An empty Buf is now False in boolean context&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Currently, we have maintained backwards compatibility with some changed pieces of syntax, but will drop them in an upcoming release:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;“&amp;lt;…&amp;gt;” in proto regex bodies; now this should be written “*”&lt;/li&gt;
&lt;li&gt;The use of “**” with a separator in regexes; this is now done by using “%” or “%%” on another quantifier&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;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:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;pack and unpack&lt;/li&gt;
&lt;li&gt;macros&lt;/li&gt;
&lt;li&gt;threads and concurrency&lt;/li&gt;
&lt;li&gt;Unicode strings at levels other than codepoints&lt;/li&gt;
&lt;li&gt;pre and post constraints, and some other phasers&lt;/li&gt;
&lt;li&gt;interactive readline that understands Unicode&lt;/li&gt;
&lt;li&gt;non-blocking I/O&lt;/li&gt;
&lt;li&gt;much of Synopsis 9&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There is a new online resource at &lt;a href=&quot;http://perl6.org/compilers/features&quot;&gt;http://perl6.org/compilers/features&lt;/a&gt; that lists the known implemented and missing features of Rakudo Star 2012.02 and other Perl 6 implementations.&lt;/p&gt;
&lt;p&gt;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 &amp;lt;rakudobug@perl.org&amp;gt;.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&quot;http://perl6.org/&quot;&gt;http://perl6.org/&lt;/a&gt; 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&lt;br /&gt;
&amp;lt;docs/UsingPerl6-draft.pdf&amp;gt; in the release tarball.&lt;/p&gt;
&lt;p&gt;The development team thanks all of the contributors and sponsors for making Rakudo Star possible.  If you would like to contribute, see &amp;lt;&lt;a href=&quot;http://rakudo.org/how-to-help&quot;&gt;http://rakudo.org/how-to-help&lt;/a&gt;&amp;gt;, ask on the perl6-compiler@perl.org mailing list, or join us on IRC #perl6 on freenode.&lt;/p&gt;
&lt;p&gt;[1] &lt;a href=&quot;http://perl6.org/compilers/features&quot;&gt;http://github.com/rakudo/rakudo&lt;/a&gt;&lt;br /&gt;
[2] &lt;a href=&quot;http://parrot.org/&quot;&gt;http://parrot.org/&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>jnthn</name>
			<uri>http://rakudo.org</uri>
		</author>
		<source>
			<title type="html">rakudo.org</title>
			<subtitle type="html">Rakudo Perl 6</subtitle>
			<link rel="self" href="http://rakudo.org/feed/"/>
			<id>http://rakudo.org</id>
		</source>
	</entry>

	<entry>
		<title type="html">Current State of Exceptions in Rakudo and Perl 6</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2011-02-exceptions.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2011-02-exceptions.html</id>
		<updated>2012-02-28T19:54:25+00:00</updated>
		<content type="html">&lt;p&gt;It's been a while since my last update on my grant work on exceptions for
Perl 6 and Rakudo, and I can report lots of progress.&lt;/p&gt;

&lt;p&gt;The work on Rakudo's exception system made me realize that we conflated two
concepts in the base exception type: on the one hand the infrastructure for
reporting errors and backtraces, and on the other hand holding some sort of
error message as an attribute.&lt;/p&gt;

&lt;p&gt;As a result, we now have a base class called &lt;code&gt;Exception&lt;/code&gt; from
which all exception types must inherit. When a non-&lt;code&gt;Exception&lt;/code&gt;
object is passed to &lt;code&gt;die()&lt;/code&gt;, it is wrapped in an object of class
&lt;code&gt;X::AdHoc&lt;/code&gt;. Other error classes can decide to generate the error
message without having an attribute for it (for example hard-coded in a
method).&lt;/p&gt;

&lt;p&gt;Typed exceptions are now thrown not only from the setting, but also from
the compiler itself, namely the grammar and the action methods. In fact the
majority of errors from these two parts of the compiler are now handled with
dedicated exception types.&lt;/p&gt;


&lt;p&gt;The most user-visible change is a new and improved backtrace printer, which
produces usually much shorter and more readable backtraces. The old one is
still available on demand. Consider the program&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; f {
    g() &lt;span class=&quot;synStatement&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
}
&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; g { &lt;span class=&quot;synStatement&quot;&gt;die&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;OH NOEZ&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt; }
f&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;The old backtrace printer produced:

&lt;/p&gt;&lt;pre&gt;OH NOEZ
  in sub g at /home/moritz/p6/rakudo/ex.pl:4
  in block &amp;lt;anon&amp;gt; at /home/moritz/p6/rakudo/ex.pl:2
  in method reify at src/gen/CORE.setting:4471
  in method reify at src/gen/CORE.setting:4376
  in method reify at src/gen/CORE.setting:4376
  in method gimme at src/gen/CORE.setting:4740
  in method eager at src/gen/CORE.setting:4715
  in method eager at src/gen/CORE.setting:1028
  in sub eager at src/gen/CORE.setting:5000
  in sub f at /home/moritz/p6/rakudo/ex.pl:2
  in block &amp;lt;anon&amp;gt; at /home/moritz/p6/rakudo/ex.pl:5
  in &amp;lt;anon&amp;gt; at /home/moritz/p6/rakudo/ex.pl:1
&lt;/pre&gt;

&lt;p&gt;Where the eager, gimme and reify methods come from the 'for' lop, which is
compiled to the equivalent of &lt;code&gt;eager (1..10).map: { g() }&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The new backtrace printer produces&lt;/p&gt;

&lt;pre&gt;OH NOEZ
  in sub g at ex.pl:4
  in sub f at ex.pl:2
  in block &amp;lt;anon&amp;gt; at ex.pl:5
&lt;/pre&gt;


&lt;p&gt;It is also a special pleasure to report that after a &lt;a href=&quot;http://irclog.perlgeek.de/perl6/2012-02-27#i_5216391&quot;&gt;walk through a
change to throw a typed exception&lt;/a&gt;, we've received a &lt;a href=&quot;https://github.com/rakudo/rakudo/pull/59&quot;&gt;pull request by a new
developer&lt;/a&gt; which also changes an exception from X::AdHoc to a dedicated
type.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Announce: Niecza Perl 6 v15 by Stefan O'Rear</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/02/msg669.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/02/msg669.html</id>
		<updated>2012-02-27T20:58:33+00:00</updated>
		<content type="html">&lt;br /&gt;    Announce: Niecza Perl 6 v15&lt;br /&gt;&lt;br /&gt;This is the fifteenth release of Niecza Perl 6, as usual scheduled on&lt;br /&gt;the last Monday of the month.  No, it's not dead.&lt;br /&gt;&lt;br /&gt;Niecza now passes more spectests than Rakudo, but that is not an entirely&lt;br /&gt;fair comparison, and we have the feature matrix now which is much more&lt;br /&gt;useful for such comparisons. [3]&lt;br /&gt;&lt;br /&gt;You can obtain a build of Niecza from [1].  This build contains a&lt;br /&gt;working compiler as a set of .exe and .dll files suitable for use with&lt;br /&gt;Mono or Microsoft .NET.  If you wish to follow latest developments,&lt;br /&gt;you can obtain the source from [2]; however, you will still need a&lt;br /&gt;binary for bootstrapping, so you gain nothing from a &quot;source is&lt;br /&gt;better&quot; perspective.&lt;br /&gt;&lt;br /&gt;Niecza is a Perl 6 compiler project studying questions about the&lt;br /&gt;efficient implementability of Perl 6 features.  It currently targets&lt;br /&gt;the Common Language Runtime; both Mono and Microsoft .NET are known to&lt;br /&gt;work.  On Windows, Cygwin is required for source builds only; see the&lt;br /&gt;README for details.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    List of changes&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Major changes]&lt;br /&gt;&lt;br /&gt;The Unicode character database bundled with Niecza has been updated to&lt;br /&gt;version 6.1.0.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Minor changes]&lt;br /&gt;&lt;br /&gt;Constant folding which fails at compile time, since it cannot succeed, now&lt;br /&gt;generates a compile-time warning. (idea from Darren Duncan)&lt;br /&gt;&lt;br /&gt;Perl 5 interoperability has made progress. (Paweł Murias)&lt;br /&gt;&lt;br /&gt;Proxy has been added.  (No real new functionality, just putting a specced&lt;br /&gt;API on an existing feature)&lt;br /&gt;&lt;br /&gt;Unused-variable warnings are now suppressed in the REPL.&lt;br /&gt;&lt;br /&gt;Added KeySet, KeyBag; substantially improved Set and Bag. (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Set operators (both Texas and Unicode) are now available; it is now possible&lt;br /&gt;to define operators in the setting beyond those defined in the grammar.&lt;br /&gt;&lt;br /&gt;Added ability to define custom iffy and diffy operators.&lt;br /&gt;&lt;br /&gt;Added $.foo(42) syntax meaning $(self.foo(42)).&lt;br /&gt;&lt;br /&gt;@*INC internals have changed again.&lt;br /&gt;&lt;br /&gt;Added Range.pick, Range.roll, &amp;amp;rmdir, &amp;amp;rungather. (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Added &amp;amp;run (uses GLib if available for more robust argument passing).&lt;br /&gt;(Solomon Foster)&lt;br /&gt;&lt;br /&gt;Compiler memory usage has been substantially optimized, approximately 40%&lt;br /&gt;less used for CORE, with a small accompanying size improvement.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Getting involved&lt;br /&gt;&lt;br /&gt;Contact sorear in irc.freenode.net #perl6 or via the sender address of&lt;br /&gt;this mailing.  Also check out the TODO file; whether you want to work&lt;br /&gt;on stuff on it, or have cool ideas to add to it, both are good.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[1] https://github.com/downloads/sorear/niecza/niecza-15.zip&lt;br /&gt;[2] https://github.com/sorear/niecza&lt;br /&gt;[3] http://perl6.org/compilers/features&lt;br /&gt;&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Parrot 4.1.0 &quot;Black-headed Parrot&quot; Released by Alvis Yardley</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/02/msg668.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/02/msg668.html</id>
		<updated>2012-02-21T21:29:07+00:00</updated>
		<content type="html">&lt;br /&gt;&lt;br /&gt;On behalf of the Parrot team, I'm proud to announce Parrot 4.1.0, also known&lt;br /&gt;as &quot;Black-headed Parrot&quot;.  Parrot (http://parrot.org/) is a virtual machine aimed&lt;br /&gt;at running all dynamic languages.&lt;br /&gt;&lt;br /&gt;Parrot 4.1.0 is available on Parrot's FTP site&lt;br /&gt;(ftp://ftp.parrot.org/pub/parrot/releases/devel/4.1.0/), or by following the&lt;br /&gt;download instructions at http://parrot.org/download.  For those who would like&lt;br /&gt;to develop on Parrot, or help develop Parrot itself, we recommend using Git to&lt;br /&gt;retrieve the source code to get the latest and best Parrot code.&lt;br /&gt;&lt;br /&gt;Parrot 4.1.0 News:&lt;br /&gt;    - Core&lt;br /&gt;        + Shared libraries and installable binaries are now stripped if&lt;br /&gt;          built with --optimize on Cygwin, which greatly reduces their&lt;br /&gt;          size on disk&lt;br /&gt;        + New experimental PCC-related ops added to core.&lt;br /&gt;    - Documentation&lt;br /&gt;        + Revised 'docs/project/release_manager_guide.pod'&lt;br /&gt;    - Tests&lt;br /&gt;        + Parrot now uses Travis CI http://travis-ci.org&lt;br /&gt;        + Parrot Continuous Integration (CI) with Travis CI means&lt;br /&gt;          every commit of Parrot is now compiled and tested on gcc,&lt;br /&gt;          g++ and clang with various Configure.pl options.&lt;br /&gt;        + CI Notifications are sent to parrot-dev, the #parrot&lt;br /&gt;          IRC channel and Smolder&lt;br /&gt;        + Cardinal and Rakudo spec tests also on Travis CI&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SHA256 message digests for the downloadable tarballs are:&lt;br /&gt;6d277862cfddc3e13f53684315f1ed3c76a053c01200652436b548be0964cf1d parrot-4.1.0.tar.gz&lt;br /&gt;826465f3b7045cf81768029b1f18a4fa05259b7268c98c9c0436bd77c74785ec parrot-4.1.0.tar.bz2&lt;br /&gt;&lt;br /&gt;Many thanks to all our contributors for making this possible, and our sponsors&lt;br /&gt;for supporting this project.  Our next scheduled release is 20 March 2012.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;br /&gt;-- &lt;br /&gt;Alvis&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Results from the Prisoner's Dilemma Challenge</title>
		<link href="http://perlgeek.de/blog-en/perl-6/prisoners-dilemma-results.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/prisoners-dilemma-results.html</id>
		<updated>2012-02-18T20:00:00+00:00</updated>
		<content type="html">&lt;p&gt;The &lt;a href=&quot;http://perlgeek.de/blog-en/perl-6/iterated-prisoners-dilemma.html&quot;&gt;Iterated
Prisoner's Dilemma Challenge&lt;/a&gt; is now closed; several interesting solutions
have been submitted.&lt;/p&gt;

&lt;p&gt;Of the &lt;a href=&quot;https://gist.github.com/1710688&quot;&gt;basic strategies&lt;/a&gt;,
&lt;em&gt;tit-for-tat&lt;/em&gt; (doing what the opponent did the last time, starting off
with cooperating) is usually the strongest. Since the &lt;em&gt;random&lt;/em&gt;
strategy is, well, random, the results fluctuate a bit.&lt;/p&gt;

&lt;p&gt;Most submitted strategies are a variation on &lt;em&gt;tit-for-tat&lt;/em&gt;,
modified in some way or another to make it stronger. All submissions
contained a strategy that is stronger than &lt;em&gt;tit-for-tat&lt;/em&gt; when tested
against the basic strategies only, though the interaction with other new
strategies made some of them come out weaker than &lt;em&gt;tit-for-tat&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;Submitted Strategies&lt;/h2&gt;

&lt;p&gt;Without any further ado, here are the strategies and a few comments on
them.&lt;/p&gt;

&lt;h3&gt;Turn the Other Cheek&lt;/h3&gt;

&lt;pre&gt;&lt;span class=&quot;synComment&quot;&gt;## Dean Serenevy; received on 2012-02-07&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;%strategies&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;turn-other-cheek-no-deal-with-devil-once-bit-twice-shy-variety-is-the-spice-o-life&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; (&lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@mine&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;*%&lt;/span&gt;) {
    &lt;span class=&quot;synSpecial&quot;&gt;my&lt;/span&gt; (&lt;span class=&quot;synIdentifier&quot;&gt;$bitten&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$shy&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$they-coop&lt;/span&gt;) &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; (&lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;False&lt;/span&gt;)&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;synStatement&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@mine&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;Z&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$me&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$them&lt;/span&gt; {
        &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$them&lt;/span&gt;          { &lt;span class=&quot;synIdentifier&quot;&gt;$they-coop&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt; }
        &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$me&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;$them&lt;/span&gt; { &lt;span class=&quot;synIdentifier&quot;&gt;$bitten&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;++;&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$shy&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt; }
        &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;$me&lt;/span&gt;           { &lt;span class=&quot;synIdentifier&quot;&gt;$shy&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;++&lt;/span&gt; }
    }

    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;True&lt;/span&gt;  &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$bitten&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;               &lt;span class=&quot;synComment&quot;&gt;# Cooperate if we have never been bitten&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;True&lt;/span&gt;  &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$bitten&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$shy&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;synComment&quot;&gt;# Turn the other cheek once&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$they-coop&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;             &lt;span class=&quot;synComment&quot;&gt;# Screw you too!&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$shy&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;gt;=&lt;/span&gt; (&lt;span class=&quot;synConstant&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;**&lt;/span&gt; (&lt;span class=&quot;synIdentifier&quot;&gt;$bitten&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;))&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;rand&lt;/span&gt;      &lt;span class=&quot;synComment&quot;&gt;# Once-bitten rand() shy&lt;/span&gt;
}&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;

&lt;/pre&gt;

&lt;h3&gt;Inevitable Betrayal&lt;/h3&gt;

&lt;pre&gt;&lt;span class=&quot;synComment&quot;&gt;## Andrew Egeler, received 2012-02-09&lt;/span&gt;

&lt;span class=&quot;synIdentifier&quot;&gt;%strategies&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;inevitable-betrayal&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;&amp;amp;inevitable-betrayal&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; inevitable-betrayal (&lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;$total&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;*%&lt;/span&gt;) { &lt;span class=&quot;synStatement&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;($total-1) ?? @theirs[*-1] // True !! False }&lt;/span&gt;

&lt;span class=&quot;synConstant&quot;&gt;%strategies&amp;lt;evil-inevitable-betrayal&amp;gt; = &amp;amp;evil-inevitable-betrayal;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;sub evil-inevitable-betrayal (:@theirs, :$total, *%) { +@theirs &amp;lt;&lt;/span&gt;
&lt;span class=&quot;synConstant&quot;&gt;($total-1) ?? @theirs[*-1] // False !! False }&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;These are variations on &lt;em&gt;tit-for-tat&lt;/em&gt; and &lt;em&gt;evil-tit-for-tat&lt;/em&gt;
which always defect in the last round, because then the opponent can't
retaliate anymore.&lt;/p&gt;

&lt;p&gt;In a typical Iterated Prisoner's Dilemma contest, strategies don't know how
many rounds are being played, just to avoid this behavior.&lt;/p&gt;

&lt;h3&gt;Tit for D'oh and Watch for Random&lt;/h3&gt;

&lt;pre&gt;&lt;span class=&quot;synComment&quot;&gt;## Solomon Foster, receievd 2012-02-10&lt;/span&gt;

&lt;span class=&quot;synIdentifier&quot;&gt;%strategies&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;tit-for-doh&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;$total&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;*%&lt;/span&gt; {
    &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$total&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;??&lt;/span&gt;  (&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;[&lt;span class=&quot;synStatement&quot;&gt;*-&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;] &lt;span class=&quot;synStatement&quot;&gt;//&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;True&lt;/span&gt;) &lt;span class=&quot;synStatement&quot;&gt;!!&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;False&lt;/span&gt;
}

&lt;span class=&quot;synIdentifier&quot;&gt;%strategies&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;watch-for-random&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;*%&lt;/span&gt; {
    &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;10&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;grep&lt;/span&gt;(&lt;span class=&quot;synStatement&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;False&lt;/span&gt;) &lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;!!&lt;/span&gt; (&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;[&lt;span class=&quot;synStatement&quot;&gt;*-&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;] &lt;span class=&quot;synStatement&quot;&gt;//&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;True&lt;/span&gt;)
}&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;tit-for-doh&lt;/em&gt; is the same as &lt;em&gt;inevitable-betrayal&lt;/em&gt;.
&lt;em&gt;watch-for-random&lt;/em&gt; defects forever once the opponent has defected too
often.&lt;/p&gt;

&lt;h3&gt;Me&lt;/h3&gt;

&lt;pre&gt;&lt;span class=&quot;synComment&quot;&gt;## Audrey Tang, received 2012-02-17&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;%strategies&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;me&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;*%&lt;/span&gt; {
    &lt;span class=&quot;synSpecial&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;role&lt;/span&gt; Me {}&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
    (&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;[&lt;span class=&quot;synStatement&quot;&gt;*-&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;] &lt;span class=&quot;synStatement&quot;&gt;//&lt;/span&gt; Me)&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;does&lt;/span&gt;(Me) &lt;span class=&quot;synPreProc&quot;&gt;but&lt;/span&gt; Me
}&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;This strategy uses a mixin in its returned boolean values to find out when
it plays against itself, or against a strategy that copies its values from
&lt;code&gt;@theirs&lt;/code&gt; (ie tit-for-tat derivatives), in which case it cooperates.
This games the system, though doesn't explicitly violates the stated rules.&lt;/p&gt;

&lt;p&gt;Audrey also deserves two dishonorable mentions for two solutions that game
the test harness or the other strategies by exploiting the technically
imperfect sandboxing:&lt;/p&gt;

&lt;pre&gt;   &lt;span class=&quot;synConstant&quot;&gt;au&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;*%&lt;/span&gt; {
       &lt;span class=&quot;synPreProc&quot;&gt;use&lt;/span&gt; MONKEY_TYPING&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;synSpecial&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;role&lt;/span&gt; TRUE {}&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;synPreProc&quot;&gt;augment&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;Bool&lt;/span&gt; {
           &lt;span class=&quot;synStatement&quot;&gt;method&lt;/span&gt; Stringy(&lt;span class=&quot;synType&quot;&gt;Bool&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;D&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;) {
               &lt;span class=&quot;synIdentifier&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;.^&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;does&lt;/span&gt;(TRUE) &lt;span class=&quot;synStatement&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;!!&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt;
           }
       }
       &lt;span class=&quot;synType&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;synPreProc&quot;&gt;but&lt;/span&gt; TRUE&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
   }&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; 

   &lt;span class=&quot;synConstant&quot;&gt;amnesia&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@mine&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;*%&lt;/span&gt; {
       &lt;span class=&quot;synSpecial&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;role&lt;/span&gt; Uh {}&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;synSpecial&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$rv&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; (&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;[&lt;span class=&quot;synStatement&quot;&gt;*-&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;] &lt;span class=&quot;synStatement&quot;&gt;//&lt;/span&gt; Uh)&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;does&lt;/span&gt;(Uh) &lt;span class=&quot;synPreProc&quot;&gt;but&lt;/span&gt; Uh&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;synIdentifier&quot;&gt;@mine&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; ()&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;synIdentifier&quot;&gt;$rv&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
   }&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Those two strategies did not compete in the tournament&lt;/p&gt;

&lt;h3&gt;Lenient in the Beginning, Then Strict&lt;/h3&gt;

&lt;p&gt;I've written my own two strategies before the tournament started. &lt;a href=&quot;http://moritz.faui2k3.org/files/prisoner-moritz.pl.txt&quot;&gt;Here is the
original&lt;/a&gt;, I've only changed the signatures to run under current
Niecza:&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;synComment&quot;&gt;# a tit for tat, but a bit more friendly at the beginning&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# to avoid hacking on forever on evil-tit-for-tat,&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# but be very stringent when the other one defects too often&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; moritz-ctft(&lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;$total&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;synStatement&quot;&gt;*%&lt;/span&gt;) {
    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;True&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;grep&lt;/span&gt;(&lt;span class=&quot;synStatement&quot;&gt;*.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;not&lt;/span&gt;)&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;elems&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; (&lt;span class=&quot;synIdentifier&quot;&gt;$total&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;10&lt;/span&gt;)&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;[&lt;span class=&quot;synStatement&quot;&gt;*-&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;]&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
}&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;%strategies&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;moritz-ctft&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;&amp;amp;moritz-ctft&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;synComment&quot;&gt;# the evil clone...&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; moritz-ectft(&lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;$total&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;synStatement&quot;&gt;*%&lt;/span&gt;) {
    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;True&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;grep&lt;/span&gt;(&lt;span class=&quot;synStatement&quot;&gt;*.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;not&lt;/span&gt;)&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;elems&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;&amp;gt;&lt;/span&gt; (&lt;span class=&quot;synIdentifier&quot;&gt;$total&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;10&lt;/span&gt;)&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;synComment&quot;&gt;# did you believe in happy ends?&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$total&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;synIdentifier&quot;&gt;@theirs&lt;/span&gt;[&lt;span class=&quot;synStatement&quot;&gt;*-&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;]&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
}&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;%strategies&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;moritz-ectft&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;&amp;amp;moritz-ectft&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
&lt;/pre&gt;

&lt;h2&gt;Results&lt;/h2&gt;

&lt;p&gt;The results vary quite a bit between runs, mostly because of the
&lt;em&gt;random&lt;/em&gt; strategy.&lt;/p&gt;

&lt;p&gt;Here is the output from a sample run. Please don't use this for
determining the &quot;winner&quot;, because it is just a random sample with no
statistical significance.&lt;/p&gt;

&lt;pre&gt;SUMMARY
2588    moritz-ectft
2577    me
2560    moritz-ctft
2491    inevitable-betrayal
2483    tit-for-tat
2480    tit-for-doh
2399    turn-other-cheek-no-deal-with-devil-once-bit-twice-shy-variety-is-the-spice-o-life
2319    watch-for-random
2272    good
1876    evil-inevitable-betrayal
1862    evil-tit-for-tat
1538    random
1145    bad
&lt;/pre&gt;

&lt;p&gt;You see, &lt;em&gt;inevitable-betrayal&lt;/em&gt; and &lt;em&gt;tit-for-doh&lt;/em&gt; are exactly
the same strategy, but the random fluctuations place them on different sides
of &lt;em&gt;tit-for-tat&lt;/em&gt;. Which is why I won't declare a winner at all, there
is simply no fair way to determine one.&lt;/p&gt;

&lt;p&gt;At first I was surprised how well the &lt;em&gt;me&lt;/em&gt; strategy performed. But
then I noticed that with the given game harness, a strategy fighting against
itself counts double (once for the first copy, once for the second copy). With
only 13 strategies participating, and such close results, harmonizing
perfectly with yourself gives you a critical advantage.&lt;/p&gt;

&lt;h3&gt;Visualizations&lt;/h3&gt;

&lt;p&gt;For each strategy you can find an image that shows how it worked with or
against another strategy. Green means cooperate, red means defect, and the
height of the bar is proportional to the resulting score.&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/bad.png&quot;&gt;bad&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a height=&quot;1248&quot; href=&quot;http://perlgeek.de/images/blog/prisoner/evil-inevitable-betrayal.png&quot; width=&quot;566&quot;&gt;evil-inevitable-betrayal&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/evil-tit-for-tat.png&quot;&gt;evil-tit-for-tat&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/good.png&quot;&gt;good&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/inevitable-betrayal.png&quot;&gt;inevitable-betrayal&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/me.png&quot;&gt;me&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/moritz-ctft.png&quot;&gt;moritz-ctft&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/moritz-ectft.png&quot;&gt;moritz-ectft&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/random.png&quot;&gt;random&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/tit-for-doh.png&quot;&gt;tit-for-doh&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/tit-for-tat.png&quot;&gt;tit-for-tat&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/turn-other-cheek-no-deal.png&quot;&gt;turn-the-other-cheek-no-deal...&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://perlgeek.de/images/blog/prisoner/watch-for-random.png&quot;&gt;watch-for-random&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Trying to Be Fair&lt;/h3&gt;

&lt;p&gt;In an attempt to reduce the impact of the &lt;em&gt;random&lt;/em&gt; strategy, I've
changed it to use the same random sequence against each player (and of course
against itself, which totally skews that particular result).&lt;/p&gt;

&lt;p&gt;Again the rankings vary between different runs of the same program, but now
at least same strategies produce mostly the same result
(&lt;em&gt;turn-the-other-cheek&lt;/em&gt; also has a random component). An example output
from such a run is&lt;/p&gt;

&lt;pre&gt;SUMMARY
2558    moritz-ectft
2543    moritz-ctft
2532    me
2457    inevitable-betrayal
2457    tit-for-doh
2445    tit-for-tat
2387    turn-other-cheek-no-deal-with-devil-once-bit-twice-shy-variety-is-the-spice-o-life
2314    watch-for-random
2248    good
1856    evil-inevitable-betrayal
1844    evil-tit-for-tat
1359    random
1100    bad
&lt;/pre&gt;

&lt;h2&gt;TL;DR&lt;/h2&gt;

&lt;p&gt;It was a lot of fun! Thanks to everybody who submitted a strategy.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html">t2: Sums of cubes</title>
		<link href="http://strangelyconsistent.org/blog/t2-sums-of-cubes"/>
		<id>tag:strangelyconsistent.org,2012-02-12:blog/t2-sums-of-cubes</id>
		<updated>2012-02-12T16:35:49+00:00</updated>
		<content type="html">&lt;p&gt;&lt;em&gt;(Guest post by Moritz Lenz.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The second task from &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;the Perl 6 Coding Contest
2011&lt;/a&gt;
needs data structures not available in core Perl 6 to be solved efficiently.&lt;/p&gt;

&lt;p&gt;But I'm getting ahead of myself here. First, let's recall the task description:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Some natural numbers can be as the sum of two positive cubes of natural
numbers. For example, 1729 is 12 cubed plus 1 cubed. Some natural numbers
can even be expressed as more than one such sum. For example, 1729 can
also be expressed as 10 cubed plus 9 cubed.

Just for clarity's sake, the sum with the two terms reversed is the
same sum, not a new one. Thus, 91 is 3 cubed plus 4 cubed, but
finding &quot;4 cubed plus 3 cubed&quot; does not count as a distinct sum.

Write a program that accepts an integer N on the command line, and
prints out the first N of these numbers in increasing order. For each
number found, print it out, as well as the sums of cubes that yield that
number.

For example:

    1729 = 12 ** 3 + 1 ** 3 = 10 ** 3 + 9 ** 3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As always, the devil is in the details. Let me add some emphasis:&lt;/p&gt;

&lt;p&gt;&quot;For each number found, print it out, as well as &lt;strong&gt;the&lt;/strong&gt; sums of cubes that
yield that number.&quot; The sums, not both sums.&lt;/p&gt;

&lt;p&gt;The 455th of such sums of cubes can be written in three different ways, not
just two:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;87539319 = 423 ** 3 + 228 ** 3 = 414 ** 3 + 255 ** 3 = 436 ** 3 + 167 ** 3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If advanced number theory offers a direct way to come up with such numbers, we
are not aware of it. That leaves the search through the pairs of positive
integers as a viable solution.&lt;/p&gt;

&lt;p&gt;Now there are basically two approaches to searching that vast space of number
pairs. The first is to queue up all such pairs in the order that they produce
the cubes, and then iterate them all, looking for double (or triple)
consecutive elements.&lt;/p&gt;

&lt;p&gt;The second is to iterate the pairs in some simpler way,
and keep all sums of cubes in a hash, looking for solutions. Since this can
produce the searched numbers out of order, a queue is needed here as well, but
on the output end this time. It also helps to have some condition for when one
is sure that no numbers smaller than some limit will be found, so that one can
safely print out the values already found.&lt;/p&gt;

&lt;p&gt;The first one sounds more elegant &lt;em&gt;a priori&lt;/em&gt;, and implictly avoids having
non-collected garbage in the data structures, but in practice the second one is
much faster, because it keeps orders of magnitudes less data in its queue.&lt;/p&gt;

&lt;p&gt;All solutions we have seen or written so far check or enqueue the numbers by
grazing half of a quadrant of the number plane in a triangular fashion,
that is they have a slowly growing first index &lt;code&gt;x&lt;/code&gt;, and a fast second index
&lt;code&gt;y&lt;/code&gt; that runs from 1 to &lt;code&gt;x&lt;/code&gt; for each value of &lt;code&gt;x&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/&quot;&gt;Here you'll find people's solutions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The following chart illustrates the run time of the solutions
we have received, as a function of how many target numbers they
should find. A drop to zero indicates that the solution threw an
error before printing out all requested numbers (limited to 1
GB virtual memory)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://strangelyconsistent.org/blog/images/timings-t2-2011.png&quot;&gt;&lt;img alt=&quot;&quot; height=&quot;425&quot; src=&quot;http://strangelyconsistent.org/blog/images/timings-t2-2011-small.png&quot; title=&quot;Click the image to see a larger version&quot; width=&quot;550&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One can see that the solutions all scale roughly exponentially
(that is, a straight line in the logarithmic plot), and that there
are two clusterings: one with steep slopes of slow solutions that
enqueue all sums of cubes, and one of milder slopes of fast solutions
that filter by hash first.&lt;/p&gt;

&lt;p&gt;It might be possible to come up with a cleverer strategy for producing
these index pairs, one that is more closely aligned to the &lt;a href=&quot;http://www.wolframalpha.com/input/?i=ContourPlot%5Bx%5E3+%2B+y%5E3%2C+%7Bx%2C+0%2C+20%7D%2C+%7By%2C+0%2C+20%7D%5D&quot;&gt;contour lines of
x &lt;em&gt;* 3 + y *&lt;/em&gt; 3&lt;/a&gt;.
Such a scheme would reduce memory usage, and maybe even run time.
If you have a nice idea for such an algorithm, please contact us. &lt;code&gt;:-)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It is possible to walk each possible integer contour line &lt;code&gt;l&lt;/code&gt;, and for each
smaller integer cube &lt;code&gt;i = x ** 3&lt;/code&gt; check if the third root of &lt;code&gt;l - i&lt;/code&gt; is
integral. Such an algorithm has the advantage of using up nearly no memory,
but it is ridiculously slow in comparison to the other approaches we have
discussed so far. But maybe there is a way to combine the advantages of all
these approaches?&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Bounded serialization, better regexes and better errors</title>
		<link href="http://6guts.wordpress.com/2012/02/10/bounded-serialization-better-regexes-and-better-errors/"/>
		<id>http://6guts.wordpress.com/?p=192</id>
		<updated>2012-02-10T00:55:18+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Here’s a quick roundup of some of the things that have been going on in Rakudo since the January release.&lt;/p&gt;
&lt;h3&gt;Bounded Serialization&lt;/h3&gt;
&lt;p&gt;This is where I’ve been focusing the majority of my efforts. At the moment, when we pre-compile Perl 6 code – such as the CORE setting with all the built-ins – we also build up a bunch of code that reconstructs the various objects that are made as a result of compile time declarations. This is done by recording an “event” for each thing that happens at compile time, then replaying them when the module/setting is loaded.&lt;/p&gt;
&lt;p&gt;We’ve done things this way throughout every generation of Rakudo to date, but as I worked on the “nom” development branch and 6model, I built things so that we could later switch over to a different model; one where all of the objects created as a result of compile-time declarations are serialized. Then, when we need to load the module, we deserialize this blob of data back into the required objects, rather than doing all of the method calls and data shuffling to build them up again.&lt;/p&gt;
&lt;p&gt;I’ve been working on this since we got the last release out. So far I’ve got the serialization and deserialization engine to a reasonably capable state; it can happily handle references between compilation units, has no problems with circular references between objects, and today I got basic support for serializing closures in place also. At this point, I’ve just got it being exercised by a bunch of tests; the next step will be to integrate it into NQP’s compilation process. I’m hoping I can get through that at the weekend, and after that it’ll be time to try and get Rakudo using it. Whether I get this landed for the February release or if we have to wait until the March one, I’m not yet sure. I know for sure I don’t want a half-baked version of it going out, so I’ll hold it for the March release if I can’t get it working as reliably as I want for the February one.&lt;/p&gt;
&lt;p&gt;Why am I working on this? Here’s some of the things that I’m aiming at as a result of this work.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Improved startup time (the deserialization should be less work than rebuilding everything up from scratch)&lt;/li&gt;
&lt;li&gt;Reduced memory during pre-compilation of modules. Most notably, I’m hoping to make a notable reduction in the memory (and time) required to build CORE.setting, which will most certainly be welcomed by anyone trying to build in a lower memory environment. The faster build will also be helpful for Rakudo developers, and enable us to be more productive.&lt;/li&gt;
&lt;li&gt;The restrictions on the “constant” declarator can be lifted, enabling use of non-literal values.&lt;/li&gt;
&lt;li&gt;Phasers as r-values can be implemented.&lt;/li&gt;
&lt;li&gt;We can implement constant folding much, much more easily, as well as build other immutables at compile time.&lt;/li&gt;
&lt;li&gt;Other nice things, no doubt. :-)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Completing this will also be one prerequisite down for much better inlining optimization support.&lt;/p&gt;
&lt;h3&gt;More Regex Bits&lt;/h3&gt;
&lt;p&gt;We now support the use of &amp;lt;x&amp;gt; in a regex to also call any predeclared lexical regex “x”. The &amp;lt;Foo::Bar::baz&amp;gt; syntax for calling a rule from another grammar is also now supported. A nasty bug that caused &amp;lt;!&amp;gt; not to work has been fixed. Finally, &amp;lt;prior&amp;gt; – which matches the same string that the last successful match did – is now implemented.&lt;/p&gt;
&lt;h3&gt;Better Errors and Exceptions&lt;/h3&gt;
&lt;p&gt;moritz++ has continued this typed exception work. We’ve also been improving various bits of error reporting to be more informative, and catching a few more things at compile time. moritz++ has also ported STD’s $*HAS_SELF handling, which gives us better handling of knowing when operations needing an invocant can take place. We currently have this work in a branch (it depends on some other work I was doing to align us with changes to how STD parses initializers, and there’s one last bug that prevents us merging it just yet; it’ll be sorted out in the coming days, I’m sure).&lt;/p&gt;
&lt;h3&gt;Pod Bits&lt;/h3&gt;
&lt;p&gt;tadzik++ dropped by with a couple of patches, one a bug fix, the other pretty cute: it makes the auto-generated usage message for MAIN subs include the declarator documentation.&lt;/p&gt;
&lt;h3&gt;Other&lt;/h3&gt;
&lt;p&gt;Thanks to moritz++, we now support copy and rename functions. There’s also been the usual range of bug fixes that we get into every release, steadily chipping away at making Rakudo better.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/192/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/6guts.wordpress.com/192/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/6guts.wordpress.com/192/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/6guts.wordpress.com/192/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/6guts.wordpress.com/192/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/6guts.wordpress.com/192/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/6guts.wordpress.com/192/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/6guts.wordpress.com/192/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/6guts.wordpress.com/192/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/6guts.wordpress.com/192/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/6guts.wordpress.com/192/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/6guts.wordpress.com/192/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/6guts.wordpress.com/192/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/6guts.wordpress.com/192/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=6guts.wordpress.com&amp;amp;blog=14597269&amp;amp;post=192&amp;amp;subd=6guts&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://6guts.wordpress.com</uri>
		</author>
		<source>
			<title type="html">6guts</title>
			<subtitle type="html">Tales of Perl 6 guts hacking</subtitle>
			<link rel="self" href="http://6guts.wordpress.com/feed/"/>
			<id>http://6guts.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">Mini-Challenge: Write Your Prisoner's Dilemma Strategy</title>
		<link href="http://perlgeek.de/blog-en/perl-6/iterated-prisoners-dilemma.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/iterated-prisoners-dilemma.html</id>
		<updated>2012-02-07T16:41:42+00:00</updated>
		<content type="html">&lt;p&gt;Here is a small task we considered for the &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;Perl
6 Coding Contest&lt;/a&gt;, but not chose to not pursue. But it's a nice little
challenge for your leisure time.&lt;/p&gt;

&lt;p&gt;In the &lt;a href=&quot;http://en.wikipedia.org/wiki/Prisoner%27s_dilemma&quot;&gt;Prisoner's
Dilemma&lt;/a&gt;, two suspected criminals can choose to not betray each other
(which we call &quot;cooperate&quot;), or betraying the other (&quot;defecting&quot;).
If only one suspect betrays the other, the traitor gets released and
the betrayed one gets a long sentence; if both betray each other, both get a
rather long sentence. If both cooperate, both get rather short sentences.&lt;/p&gt;

&lt;p&gt;It becomes more interesting when the dilemma is repeated multiple times.
Now instead of prison sentences the contestants are assigned scores, which
add up over multiple rounds.&lt;/p&gt;

&lt;p&gt;I challenge you to write one or two strategies for the iterated prisoner's
dilemma, and send them to moritz@faui2k3.org no later than Friday
February 17.&lt;/p&gt;

&lt;p&gt;You'll find &lt;a href=&quot;https://gist.github.com/1710688&quot;&gt;some basic
strategies and a harness here&lt;/a&gt;. It runs on both newest Rakudo and
Niecza.&lt;/p&gt;

&lt;p&gt;The scoring is as follows, where &lt;code&gt;True&lt;/code&gt; means cooperate and
&lt;code&gt;False&lt;/code&gt; means defect:&lt;/p&gt;

&lt;pre&gt;my %scoring =
    'True True' =&amp;gt; [4, 4],
    'True False' =&amp;gt; [0, 6],
    'False True' =&amp;gt; [6, 0],
    'False False' =&amp;gt; [1, 1],
&lt;/pre&gt;

&lt;p&gt;Your strategy should be a subroutine or block that accepts the named
parameters &lt;code&gt;mine&lt;/code&gt; and &lt;code&gt;theirs&lt;/code&gt;, which are lists
of previous decisions of your own algorithm and of its opponents, and
&lt;code&gt;total&lt;/code&gt;, which is the number of laps to be played. It should
return &lt;code&gt;True&lt;/code&gt; if it wishes to cooperate, and &lt;code&gt;False&lt;/code&gt; to
defect.&lt;/p&gt;

&lt;p&gt;Here is an example strategy that starts off with cooperating, and then
randomly chooses a previous reaction of the current opponent:&lt;/p&gt;

&lt;pre&gt;sub example-strategy(:@theirs, *%) {
    @theirs.roll // True;
}
&lt;/pre&gt;

&lt;p&gt;Your strategy or strategies will play against each other and against the
example strategies in the gist above. It is not allowed to submit strategies
that commit suicide to actively support another strategy.&lt;/p&gt;

&lt;p&gt;I too have written two strategies that will take participate in the
contest. Here is the checksum to convince you I won't alter the strategies
in response to the submissions:&lt;/p&gt;

&lt;pre&gt;6d4ba99b66e4963a658c8dcfc72922dd0f74e0ad  prisoner-moritz.pl
&lt;/pre&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html">A four-quarter plan for psyde</title>
		<link href="http://strangelyconsistent.org/blog/a-four-quarter-plan-for-psyde"/>
		<id>tag:strangelyconsistent.org,2012-02-05:blog/a-four-quarter-plan-for-psyde</id>
		<updated>2012-02-05T15:15:49+00:00</updated>
		<content type="html">&lt;p&gt;&lt;em&gt;(If this blog had had a tagging system, this post would have been tagged &quot;meta&quot;. You have been warned.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;My blogging engine, &lt;a href=&quot;http://github.com/masak/psyde&quot;&gt;psyde&lt;/a&gt;, is written in Perl 6. It's been serving me well in the past year-and-a-quarter since use.perl went read-only and &lt;a href=&quot;http://strangelyconsistent.org/blog/dog-food-with-a-distinct-perl6-flavor&quot;&gt;forced my hand&lt;/a&gt; to move out. It's not too powerful, and it's kinda idiosyncratic, but it has definitely made me happy.&lt;/p&gt;

&lt;p&gt;Howver, I've increasingly been picturing where I want to take the engine. It could do more, and I know what bits I want it to do. But I never seem to get to the point where I sit down and tinker with the engine to make it better. You know, 'cus of tuits and yaks and worse-is-better and all that.&lt;/p&gt;

&lt;p&gt;So, here goes. Now I'm changing that. Here's a four-quarter plan for 2012:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Q1: &lt;strong&gt;A way to create/edit posts online.&lt;/strong&gt; All my posts sit in a repository, and theoretically I should be able to post from anywhere, just as one would expect from a blogging system. But in practice, I always forget to push the latest changes, which makes my local copy on my laptop at home the athoritative copy, and so I've no choice but to post from home. Better then to author all the posts online, to store the post sources on the server, and to have those be the authoritative copy.&lt;/p&gt;

&lt;p&gt;Also, while writing posts in Emacs is hard to beat from a text-editing perspective, one advantage of authoring posts on the web is that I would be able to &lt;a href=&quot;http://www.showdown.im/&quot;&gt;see the final HTML in real time&lt;/a&gt;. Better than having to wait through a compilation process to see how things will turn out.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Q2: &lt;strong&gt;A commenting system.&lt;/strong&gt; Finally. This includes converting the old comments from my use.perl blog and retroactively adding them, too. I'd like to use something like openID as an authentication system, or more generally, something ready-made that makes it easy to just post a comment.&lt;/p&gt;

&lt;p&gt;I've had &lt;a href=&quot;http://www.disqus.com/&quot;&gt;Disqus&lt;/a&gt; recommended to me as a way to add a commenting system. While it would certainly work, it's slightly against the spirit of psyde, which is more or less &lt;a href=&quot;http://en.wikipedia.org/wiki/Not_invented_here&quot;&gt;NIH&lt;/a&gt;. I believe it's sometimes healthy to reinvent wheels, as much to learn how to make them round as to figure out how they can be made to work better. More importantly, I wouldn't be as happy with someone else's wheel, even a well-oiled one, as with my own.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Q3: &lt;strong&gt;A text-oriented graphic library.&lt;/strong&gt; I often desire to inject an image/graph/diagram or other in my blog posts, explaining the relationship between some things. But there are too many steps involved:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;open up Inkscape&lt;/li&gt;
&lt;li&gt;painstakingly draw and position a bunch of rectangles and arrows and text fields&lt;/li&gt;
&lt;li&gt;export to .png&lt;/li&gt;
&lt;li&gt;upload the .png&lt;/li&gt;
&lt;li&gt;insert an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag linking to where I uploaded the .png&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;...and besides, I always feel like I'm doing work that the computer should be doing for me, drawing the SVG. I've drawn graphs like that a hundred times before, and they all look the same.&lt;/p&gt;

&lt;p&gt;Imagine if I could just write a few symbols in my post saying &quot;oh boy, here comes le graph!&quot;, a bit like &lt;code&gt;\[&lt;/code&gt; takes me into the &lt;code&gt;displaymath&lt;/code&gt; environment in LaTeX. And, &lt;em&gt;and&lt;/em&gt;! Because the groundwork I will have done in Q1 enables me to see things as I type in real time, and because the graphic library that I haven't written yet will be mostly implemented in JavaScript, those graphs will appear as I type them, too! Instant graphic!&lt;/p&gt;

&lt;p&gt;I haven't seen any other blog system do this. Let me know if there's prior art.&lt;/p&gt;

&lt;p&gt;The graphic library will support not just graphs, but any number of pre-set picture drawing modes: graphs, class diagrams, chess boards, hex boards, tables, Nim positions, pentomino pieces, sudoku boards, sparklines, basically anything. Adding another mode should be as simple (for a programmer) as adding a syntax parser and a generator of iamge elements. There will have to be an API for all of this; details pending.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Q4: &lt;strong&gt;Productize psyde.&lt;/strong&gt; After all of this, I actually think I'll have something worth sharing with people. Not everyone will prefer to leave the cozy confines of Wordpress or Movable Type or whatever it is you kids use these days, but some people will like the combination of features in psyde, and will want to set up their own blog with it.&lt;/p&gt;

&lt;p&gt;(This already happened once, by the way. I'm not at all prepared for this, so I just sent them a &lt;code&gt;.tar.gz&lt;/code&gt; file with the minimal environment needed to get set up, and they succeeded. It was a slightly bumpy ride for them, of course, but they got it working.)&lt;/p&gt;

&lt;p&gt;Now psyde isn't really a blogging system at its core, but a static web page generator. Making a product out of it probably means turning a bunch of things into modules, and have them play nicely with &lt;a href=&quot;http://modules.perl6.org/&quot;&gt;the Perl 6 ecosystem&lt;/a&gt;. And to make setup a one-click operation, or as close to it as possible. Probably psyde the static web generator and the yet-unnamed blogging software will separate into a module-client relation as a part of this.&lt;/p&gt;

&lt;p&gt;When I say &quot;product&quot;, by they way, I don't imagine I'll charge money for it. The source will remain free in all senses. I just want to make it easier to approach the software and get started with it. Removing various hard-coded things, as well as adding documentation and installation instructions, will be necessary.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Early on, I told myself that this would be a ten-year blog. We're now a few months into the second year. It's time to introduce some furniture and make this blog engine fit to live in. Fit to relax in after a hard day's work.&lt;/p&gt;

&lt;p&gt;I want to be able to blog from my iPad. Or from a 40-inch TV screen. Or, in a pinch, from my Android phone. I want people to be able to comment. I want those graphs, oh nicely laid out, skinnable, auto-generated instant-gratification graphs! And I want to push psyde out into the wild, make it stand on its own legs.&lt;/p&gt;

&lt;p&gt;I want to use Perl 6 more in production, because the time is here. Even though I know it's prudent to underpromise and overdeliver, I choose to publish my plans like this because so far I've only been scheming and dreaming — this somehow makes it all more concrete.&lt;/p&gt;

&lt;p&gt;Onwards!&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">t1: Expressing integers using four nines</title>
		<link href="http://strangelyconsistent.org/blog/t1-expressing-integers-using-four-nines"/>
		<id>tag:strangelyconsistent.org,2012-02-03:blog/t1-expressing-integers-using-four-nines</id>
		<updated>2012-02-03T22:43:28+00:00</updated>
		<content type="html">&lt;p&gt;&lt;em&gt;(This is a guest post by Moritz Lenz. If you're wondering what this is all about,
it's the aftermath of &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;The 2011 Perl 6 Coding
Contest&lt;/a&gt;. If you're
not wondering, it's still about that.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let's consider the first task from &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;the Perl 6 Coding Contest
2011&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here is the description of the task once more:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;What non-negative integers can you write as expressions containing exactly
four occurrences the number 9, and any of the binary operators *, /, %, +,
-, prefix negations, and any number of matching pairs of parentheses you
care to use?

The program should accept an upper limit N as a command-line argument.
It should then print all integers 0..N in increasing order, along with
an expression with four nines, if any such was found.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It was probably the easiest of all tasks, and the one we got the most
submissions for. Yet there were still some things that could go wrong,
and some submissions got some of them wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;non-negative&lt;/em&gt; implies that we start at &lt;code&gt;0 = 9 + 9 - 9 - 9&lt;/code&gt;, not at &lt;code&gt;1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;integers&lt;/em&gt; means that the result must be an integer; it does not mean that intermediate results are automatically rounded or truncated&lt;/li&gt;
&lt;li&gt;the expressions must consist of four times the &lt;em&gt;number&lt;/em&gt; 9, not the &lt;em&gt;digit&lt;/em&gt;
nine. Thus &lt;code&gt;99&lt;/code&gt; is not a valid expression of two nines.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All contestants solved this task with the following strategy: first find all
possible expressions involving four nines (and possibly filter out those out
of range), then iterate the numbers from 0 to N and check for each if an
expression was found.&lt;/p&gt;

&lt;p&gt;One possible approach to generate all expresions is to hard-code all
expressions with one nine, namely &lt;code&gt;9&lt;/code&gt; and &lt;code&gt;-9&lt;/code&gt;. Then apply all
operators to all combinations of those, and thus generate all expressions
with two nines. This is a good time for filtering out duplicates, for example
&lt;code&gt;18 == 9 + 9 == 9 - (-9)&lt;/code&gt;. Then expressions of greater length can be generated
from the shorter ones in the same manner.&lt;/p&gt;

&lt;p&gt;There are just two small pitfalls: the first is that one has to remember that
not all expressions can be generated by combining expressions of length &lt;code&gt;(N-1)&lt;/code&gt;
and 1. For example &lt;code&gt;324 == (9 + 9) * (9 + 9)&lt;/code&gt; can only be written as the
combination of two expressions with two nines each. The second small pitfall
is that three of the operators (&lt;code&gt;%&lt;/code&gt;, &lt;code&gt;/&lt;/code&gt; and &lt;code&gt;-&lt;/code&gt;) are not commutative, so one
has to explicitly try both combinations of &lt;code&gt;$a op $b&lt;/code&gt; and &lt;code&gt;$b op $a&lt;/code&gt;, or
take care of that in some other way.&lt;/p&gt;

&lt;p&gt;The task description allowed the prefix minus operator, but including it
into the production does not produce any new numbers; it is sufficent to seed
the expressions of length one with &lt;code&gt;(9, -9)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As usual, we've published each contestant's code along with a review; feel
free to &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/&quot;&gt;have a look&lt;/a&gt;. This year,
we're also publish solutions from people who sent in solutions but didn't
sign up for the contest.&lt;/p&gt;

&lt;p&gt;Isn't it noteworthy how, even with this narrow a task, people's solutions
are all over the board in terms of the constructs used, code size, and style?
We think so.&lt;/p&gt;

&lt;p&gt;Stand by for the review on t2: &quot;Sums of cubes&quot;.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Announce: Niecza Perl 6 v14 by Stefan O'Rear</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/01/msg667.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/01/msg667.html</id>
		<updated>2012-01-30T21:00:51+00:00</updated>
		<content type="html">&lt;br /&gt;    Announce: Niecza Perl 6 v14&lt;br /&gt;&lt;br /&gt;This is the fourteenth release of Niecza Perl 6, as usual scheduled on&lt;br /&gt;the last Monday of the month.  I'm on winter break now, which means lots&lt;br /&gt;of time for improvements.  Muahahaha.  This month hasn't seen much of a&lt;br /&gt;focus.&lt;br /&gt;&lt;br /&gt;With this release, Niecza now passes a similar number of spectests as&lt;br /&gt;Rakudo.  (Note that they are not the same tests, and as such the test counts&lt;br /&gt;are not completely comparable.)  Solomon Foster has begun efforts to port&lt;br /&gt;panda to niecza, with the goal of designing a multi-implementation ecosystem.&lt;br /&gt;&lt;br /&gt;You can obtain a build of Niecza from [1].  This build contains a&lt;br /&gt;working compiler as a set of .exe and .dll files suitable for use with&lt;br /&gt;Mono or Microsoft .NET.  If you wish to follow latest developments,&lt;br /&gt;you can obtain the source from [2]; however, you will still need a&lt;br /&gt;binary for bootstrapping, so you gain nothing from a &quot;source is&lt;br /&gt;better&quot; perspective.&lt;br /&gt;&lt;br /&gt;Niecza is a Perl 6 compiler project studying questions about the&lt;br /&gt;efficient implementability of Perl 6 features.  It currently targets&lt;br /&gt;the Common Language Runtime; both Mono and Microsoft .NET are known to&lt;br /&gt;work.  On Windows, Cygwin is required for source builds only; see the&lt;br /&gt;README for details.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    List of changes&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Breaking changes]&lt;br /&gt;&lt;br /&gt;Multiple dispatch has been changed to reject all cases of ambiguity using&lt;br /&gt;an explicit list of conflictors; some ambiguous cases were formerly accepted.&lt;br /&gt;&lt;br /&gt;List iteration has been modified to throw an exception when the list generator&lt;br /&gt;tries to access the unreified part of the list.  The previous code exhibited&lt;br /&gt;undefined behavior that some code actually relied on.&lt;br /&gt;&lt;br /&gt;Parameters like @foo and %foo now insist that their arguments be Positional and&lt;br /&gt;Associative respectively.&lt;br /&gt;&lt;br /&gt;Rat and Complex stringification has been substantially changed.&lt;br /&gt;&lt;br /&gt;Niecza now enforces &quot;trusts&quot;.&lt;br /&gt;&lt;br /&gt;&amp;amp;nextwith and CallFrame.args now conspire to hide the invocant parameter.  If&lt;br /&gt;you are calling nextwith directly, you no longer need to - and must no longer -&lt;br /&gt;pass a self argument.&lt;br /&gt;&lt;br /&gt;|$foo capture parameters now capture the logical &quot;current&quot; capture, rather&lt;br /&gt;than the &quot;initial&quot; capture.  In particular, 'method (|$foo)' no longer results&lt;br /&gt;in $foo containing self.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Major features]&lt;br /&gt;&lt;br /&gt;END blocks are now suppported.&lt;br /&gt;&lt;br /&gt;The subroutine entry process has been significantly modified to allow&lt;br /&gt;signatures to reference variables and anonymous code blocks.&lt;br /&gt;&lt;br /&gt;Roles have been overhauled to much more closely match the Rakudo nom behavior.&lt;br /&gt;Importantly, roles now have a $?CLASS parameter, and role blocks are not run&lt;br /&gt;until that is available.  Role composition at compile time is now supported,&lt;br /&gt;as is role summation, attributes in roles, role conflict detection, type&lt;br /&gt;checking against roles, etc.  &amp;amp;infix:&amp;lt;does&amp;gt; and &amp;amp;infix:&amp;lt;but&amp;gt; now support&lt;br /&gt;much more of specced behaviors.&lt;br /&gt;&lt;br /&gt;Accompanying that, the old tag and mixin classes CommonEnum, IntBasedEnum,&lt;br /&gt;StrBasedEnum, Callable, Positional, Associative, Numeric, and Real have been&lt;br /&gt;converted into roles.&lt;br /&gt;&lt;br /&gt;Major signature improvements: Added support for sub-signatures, where blocks,&lt;br /&gt;proper MMD with subtypes, values used as types.  Parameter and Signature&lt;br /&gt;objects are now reified into Perl 6 space and support a subset of the Rakudo&lt;br /&gt;nom introspection API.&lt;br /&gt;&lt;br /&gt;Niecza now supports constant folding!  If you mark a sub 'is pure' and call&lt;br /&gt;it with sufficiently constant arguments, it will be replaced at compile time&lt;br /&gt;with the result of the call, provided said call does not throw an exception.&lt;br /&gt;What constitutes &quot;sufficiently constant&quot; is not documented, poorly defined,&lt;br /&gt;and subject to change.&lt;br /&gt;&lt;br /&gt;Niecza now keeps attributes from different classes in different namespaces,&lt;br /&gt;so you can have $!x in both a parent and a child class without issues.&lt;br /&gt;Additionally, the sigil is part of the name, so you can now have both $!x&lt;br /&gt;and @!x.&lt;br /&gt;&lt;br /&gt;val() is now supported, and is used automatically on &amp;lt;&amp;gt; lists.&lt;br /&gt;&lt;br /&gt;MAIN is now supported.&lt;br /&gt;&lt;br /&gt;STD-imported syntax changes: \foo and |foo parameters no longer require a&lt;br /&gt;sigil.  my \foo = ... works to declare a &quot;raw&quot; variable.  Initializer&lt;br /&gt;assignment now binds tightly to the declarator, so that e.g. (5 + my $x = 3)&lt;br /&gt;does something more useful.&lt;br /&gt;&lt;br /&gt;.WHICH has been added, and === does the correct thing with value types now.&lt;br /&gt;&lt;br /&gt;Perl 5 interop improvements: can now be used from any directory and builds&lt;br /&gt;much more robustly.  Also supports more pass and return cases.  (Paweł Murias)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Minor features]&lt;br /&gt;&lt;br /&gt;No more pseudo-evaluators - all constructs which contain code that logically&lt;br /&gt;is run at BEGIN time to produce a value, is now actually run rather than&lt;br /&gt;attempting a static evaluation.&lt;br /&gt;&lt;br /&gt;Binding to attributes is now supported.&lt;br /&gt;&lt;br /&gt;Class attribute forms such as my $.foo, and the aliasing form has $foo, are&lt;br /&gt;now supported.&lt;br /&gt;&lt;br /&gt;Within a named 'anon sub', the name is visible, allowing for nicer recursion.&lt;br /&gt;&lt;br /&gt;* now properly ignores assignments.&lt;br /&gt;&lt;br /&gt;$obj.Foo::bar, $obj.::(&quot;Foo::bar&quot;), and /&amp;lt;::(&quot;Foo::bar&quot;)&amp;gt;/ are now accepted.&lt;br /&gt;&lt;br /&gt;You can now set 'is iffy' and 'is diffy' for fully custom operators.&lt;br /&gt;&lt;br /&gt;Type adverbs :_ :U :D :T are now accepted.&lt;br /&gt;&lt;br /&gt;Signatures like (Int, Int) are now allowed.&lt;br /&gt;&lt;br /&gt;Phaser handling has been improved, and support added for CHECK.&lt;br /&gt;&lt;br /&gt;Aliasing forms like &amp;lt;foo=$bar&amp;gt; are now allowed.&lt;br /&gt;&lt;br /&gt;Version information is now embedded into the build, allowing for --version&lt;br /&gt;and $?PERL support.&lt;br /&gt;&lt;br /&gt;Printing of unhandled exceptions uses .gist.&lt;br /&gt;&lt;br /&gt;Multiple dispatch now handles junctions.&lt;br /&gt;&lt;br /&gt;Exporting multisubs from modules now approximately works.&lt;br /&gt;&lt;br /&gt;Added &quot;.Bridge&quot; support. (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Attribute-binding parameters (:$!foo) now implemented.&lt;br /&gt;&lt;br /&gt;:16() syntax is now supported.&lt;br /&gt;&lt;br /&gt;Defaults and type constraints that are constants are now saved as such,&lt;br /&gt;avoiding an unneeded block.&lt;br /&gt;&lt;br /&gt;Str.perl now escapes special characters.&lt;br /&gt;&lt;br /&gt;CLR interop now supports calls to shadowed and hidden methods, like&lt;br /&gt;$obj.CLR::System::IDisposable.Dispose().  Note that this can NOT be used to&lt;br /&gt;call overriden methods (callvirt semantics are used).&lt;br /&gt;&lt;br /&gt;LTM processing ignores arguments and dispatchers forward the arguments to&lt;br /&gt;multi regexes.&lt;br /&gt;&lt;br /&gt;infix:&amp;lt;cmp&amp;gt; supports pairs, ±Inf (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Hash.perl sorts the output to be slightly more useful.&lt;br /&gt;&lt;br /&gt;New setting things:&lt;br /&gt;Cool.polar, Cool.roots, &amp;amp;roots, Array.delete, &amp;amp;infix:&amp;lt;minmax&amp;gt;, &amp;amp;rotate,&lt;br /&gt;CommonEnum.pick, CommonEnum.roll, Any.min, Any.max, Any.minmax, Str.trans,&lt;br /&gt;&amp;amp;elems, Any.reduce, &amp;amp;reduce, &amp;amp;shell, &amp;amp;categorize, &amp;amp;cwd, &amp;amp;chdir, $*CWD,&lt;br /&gt;&amp;amp;printf, IO.copy, IO.chmod&lt;br /&gt;(Solomon Foster)&lt;br /&gt;&lt;br /&gt;Hash.push (Moritz Lenz)&lt;br /&gt;&lt;br /&gt;Int.base, Array.splice, &amp;amp;splice (Will Coleda)&lt;br /&gt;&lt;br /&gt;Set, Bag (Larry Wall, Solomon Foster)&lt;br /&gt;&lt;br /&gt;&amp;amp;prefix:&amp;lt;sleep&amp;gt;, Mu.clone, &amp;amp;undefine, $*OS, Order, $*OUT, $*ERR&lt;br /&gt;&lt;br /&gt;split and comb now support limits of Whatever (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Range coerces values to numbers according to spec (Solomon Foster)&lt;br /&gt;&lt;br /&gt;&amp;amp;sort accepts a Callable first argument (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Added limit to &amp;amp;lines, :r and :rw to &amp;amp;open (Solomon Foster)&lt;br /&gt;&lt;br /&gt;min and max support arbitrarily many arguments (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Changed sleep to return a value (Will Coleda)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Other]&lt;br /&gt;&lt;br /&gt;Daniel Ruoso is attempting an implementation of concurrent feeds.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Getting involved&lt;br /&gt;&lt;br /&gt;Contact sorear in irc.freenode.net #perl6 or via the sender address of&lt;br /&gt;this mailing.  Also check out the TODO file; whether you want to work&lt;br /&gt;on stuff on it, or have cool ideas to add to it, both are good.&lt;br /&gt;&lt;br /&gt;    Future directions&lt;br /&gt;&lt;br /&gt;Next month is likely to see fewer tuits in general.  The only concrete plan&lt;br /&gt;I have is to continue with 6model convergence, hopefully reaching a point&lt;br /&gt;where user-defined metaclasses are possible.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[1] https://github.com/downloads/sorear/niecza/niecza-14.zip&lt;br /&gt;[2] https://github.com/sorear/niecza&lt;br /&gt;&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Macros progress report: interesting things</title>
		<link href="http://strangelyconsistent.org/blog/macros-progress-report-interesting-things"/>
		<id>tag:strangelyconsistent.org,2012-01-29:blog/macros-progress-report-interesting-things</id>
		<updated>2012-01-29T18:26:35+00:00</updated>
		<content type="html">&lt;p&gt;I'm here to report that the macros grant is coming along nicely. I've been busier with &lt;code&gt;$dayjob&lt;/code&gt; than anticipated, and so the schedule in the grant application is slipping a bit. But I have a fairly good view of the obstacles and to-do items ahead.&lt;/p&gt;

&lt;p&gt;When we &lt;a href=&quot;http://strangelyconsistent.org/blog/macros-progress-report-a-bit-of-d1&quot;&gt;last saw each other&lt;/a&gt;, I was saying that &quot;variable lookups from inside of the quasiquote end up confused&quot;. That's still true, and it's the big thing I want to fix before merging my work so far into the &lt;code&gt;master&lt;/code&gt; branch, er, into the &lt;code&gt;nom&lt;/code&gt; branch.&lt;/p&gt;

&lt;p&gt;What I've done since last time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I &lt;a href=&quot;https://gist.github.com/1548053&quot;&gt;wrote a thorough explanation&lt;/a&gt; of why ASTs need to carry around their original lexical environment. (Short explanation: they need to act like closures, but they aren't really so they need to fake it.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I &lt;a href=&quot;https://github.com/rakudo/rakudo/tree/macros2&quot;&gt;re-based the &lt;code&gt;macros&lt;/code&gt; branch&lt;/a&gt; on the latest &lt;code&gt;nom&lt;/code&gt;, and fixed a bunch of regressions in my code that fell out of that.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I &lt;a href=&quot;https://github.com/perl6/roast/blob/master/S06-macros/macros-d1.t&quot;&gt;started a test file&lt;/a&gt; with macro tests that are more adapted to the work that I'm doing than the tests that are already there. I hope to be able to absorb the ones that are there as we go along; right now they're not much use to me.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now I'm well poised to go in and actually implement the lexical fixup I need for the ASTs to behave as if they're normal, honest-to-goblin closures. I just thought I'd blog this report in case I end up walking into the source code, never to return. &lt;code&gt;:-)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The trick is this: &lt;a href=&quot;https://github.com/rakudo/rakudo/blob/9719f7d99602fdaaa277a6bdec40a2fad5d5c5ea/src/Perl6/Actions.pm#L468&quot;&gt;&lt;code&gt;.SET_BLOCK_OUTER_CTX&lt;/code&gt;&lt;/a&gt;. It lets you say &quot;block, your &lt;code&gt;OUTER&lt;/code&gt; is now this thingy&quot;. It's the kind of internal fixup that makes the cat walk by twice inside the Matrix.&lt;/p&gt;

&lt;p&gt;Ok, I'm going in. See you on the other side.&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">The Perl 6 Coding Contest (2011 edition) is now closed</title>
		<link href="http://strangelyconsistent.org/blog/the-perl-6-coding-contest-2011-edition-is-now-closed"/>
		<id>tag:strangelyconsistent.org,2012-01-29:blog/the-perl-6-coding-contest-2011-edition-is-now-closed</id>
		<updated>2012-01-29T12:04:28+00:00</updated>
		<content type="html">&lt;div style=&quot;background: #ded; margin: 1em; padding: 1em;&quot;&gt;&lt;code&gt;&quot;Thanks for organizing the contest. Staying awake until 3am trying to make my solutions work (and trying to write them in a perl6ish way) was big fun! :)&quot;&lt;br /&gt;        — one of the contestants &lt;/code&gt;&lt;/div&gt;

&lt;p&gt;Ding! Pencils down.&lt;/p&gt;

&lt;p&gt;So, here we are, five weeks later. Let's sum up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;35 people signed up as contestants this year.&lt;/li&gt;
&lt;li&gt;6 contestants submitted solutions.&lt;/li&gt;
&lt;li&gt;27 submissions passed a &lt;code&gt;base-test&lt;/code&gt; run and were accepted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Last year's figures for the same things are (18, 5, 26), so somehow we ended up with many more contestants and only one more submission this year. That's fine; we know that the step from signing up to actually sending something in is quite a big one to take. Very interested to get feedback on how to make that step easier, though.&lt;/p&gt;

&lt;p&gt;Just as last year, we'll synchronously publish people's solutions for each task in sequence, along with a blog post about the task and its solutions.&lt;/p&gt;

&lt;p&gt;Unlike last year, I won't promise that these posts will be forthcoming in &quot;the next few days/weeks&quot;. Last year it took over two months to process everything and get to the winner. Let's aim for one month this time — we're as expectant as you are to see solutions, blog post explanations, and an eventual winner!&lt;/p&gt;

&lt;p&gt;Let's do this! First up: &quot;Four 9s.&quot;&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Modules and Perl 6s</title>
		<link href="http://justrakudoit.wordpress.com/2012/01/29/modules-and-perl-6s/"/>
		<id>http://justrakudoit.wordpress.com/?p=390</id>
		<updated>2012-01-29T03:09:35+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;I’ve got my fork of Panda working on Niecza.  There are two major issues which remain to be resolved, and they are both related.  Panda assumes that the Perl 6 executable is named &lt;code&gt;perl6&lt;/code&gt;, and modules should be installed to &lt;code&gt;~/.perl6&lt;/code&gt;.  That’s great if you have just one Perl 6 on your system.&lt;/p&gt;
&lt;p&gt;But in this crazy modern world, I really want both Rakudo and Niecza on my system.  And so assuming that everything can be named “perl6″ is a big problem.&lt;/p&gt;
&lt;p&gt;I’m hoping the community can put their heads together and figure out a solution.  I guess the obvious one (which would only need sorear to buy in) would be installing Niecza modules to &lt;code&gt;~/.niecza&lt;/code&gt;, and creating a “real” &lt;code&gt;niecza&lt;/code&gt; executable.  (It might well be as simple as a one-line script “mono path-to-Niecza.exe”.)&lt;/p&gt;
&lt;p&gt;Good idea or bad idea?&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/justrakudoit.wordpress.com/390/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/justrakudoit.wordpress.com/390/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/justrakudoit.wordpress.com/390/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/justrakudoit.wordpress.com/390/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/justrakudoit.wordpress.com/390/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/justrakudoit.wordpress.com/390/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/justrakudoit.wordpress.com/390/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/justrakudoit.wordpress.com/390/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/justrakudoit.wordpress.com/390/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/justrakudoit.wordpress.com/390/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/justrakudoit.wordpress.com/390/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/justrakudoit.wordpress.com/390/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/justrakudoit.wordpress.com/390/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/justrakudoit.wordpress.com/390/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=justrakudoit.wordpress.com&amp;amp;blog=12219098&amp;amp;post=390&amp;amp;subd=justrakudoit&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>colomon</name>
			<uri>http://justrakudoit.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Just Rakudo It</title>
			<subtitle type="html">I Never Metaop I Didn't Like</subtitle>
			<link rel="self" href="http://justrakudoit.wordpress.com/feed/"/>
			<id>http://justrakudoit.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">This month’s Rakudo Star release – and what’s coming next</title>
		<link href="http://6guts.wordpress.com/2012/01/29/this-months-rakudo-star-release-and-whats-coming-next/"/>
		<id>http://6guts.wordpress.com/?p=188</id>
		<updated>2012-01-29T00:41:57+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;So, we made it – a &lt;a href=&quot;http://rakudo.org/2012/01/28/rakudo-star-2012-01-released/&quot;&gt;Rakudo Star release&lt;/a&gt; based on the “nom” development branch has landed. It’s based on the compiler release moritz++ cut earlier this week, and pmichaud++, masak++ and myself have been involved in getting the Star-specific build and installation scripts in shape.&lt;/p&gt;
&lt;p&gt;Getting to this release has been a lot of work; in many sense this is a revolution in Rakudo’s development rather than a small evolutionary step over what we had before. It’s taken a while (indeed, longer than I’d first hoped) and has been a lot of work – but it was worth it. Not just because of the many improvements that are in this release, but because of the enormous future potential that we now have.&lt;/p&gt;
&lt;p&gt;Here’s some of the things I’m happiest about in the release.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The performance improvements in many areas. Yes, we’ve plenty of work to do here – but this is a solid step forward for a wide range of scripts, and in some cases an order of magnitude improvement.&lt;/li&gt;
&lt;li&gt;That 6model – something I started designing a year and a half ago – has not only cleanly supported all of the things we needed to do in Rakudo, but also opened up so many other doors. For example, the new NativeCall module uses its representation polymorphism support to great effect.&lt;/li&gt;
&lt;li&gt;Protoregexes doing real NFA-driven Longest Token Matching rather than the cheating version we had before that only operated on literals.&lt;/li&gt;
&lt;li&gt;The optimizer, along with the various extra compile time error reporting it gives. This will be an important future area for Rakudo.&lt;/li&gt;
&lt;li&gt;Initial native type support, and bigint semantics for the Int type.&lt;/li&gt;
&lt;li&gt;The POD6 support, thanks to tadzik++’s Google Summer of Code grant in summer.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, what’s next? Currently I’m working hard on getting true bounded serialization support in place. This should further improve BEGIN time support (including constructs that depend on BEGIN time), greatly cut down resource consumption during CORE.setting compilation (both time and memory) and give us faster startup. It’s hard to guess at figures for the improvement, but I’m expecting it to be a noticeable improvement in all of these areas. I’m aiming at getting this landed for the next Rakudo compiler release (which I expect us to do a Star release based on too), though largely it depends on whether I can get it working and stable enough in time; while some parts are a simple matter or programming, other parts are tricky.&lt;/p&gt;
&lt;p&gt;That aside, we’ve already got various other new features in the pipeline; even since last weekend’s compiler release, there are multiple new regex-related things in place, moritz++ has continued with his typed exceptions work, we’re catching a couple more errors at compile time rather than letting them slip through until runtime, and there’s various other miscellaneous bug fixes. Also, masak++ is working on macros in a branch, and I’m optimistic that we’ll have some initial macro support in place by the next release also. Busy times! :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/188/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/6guts.wordpress.com/188/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/6guts.wordpress.com/188/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/6guts.wordpress.com/188/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/6guts.wordpress.com/188/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/6guts.wordpress.com/188/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/6guts.wordpress.com/188/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/6guts.wordpress.com/188/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/6guts.wordpress.com/188/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/6guts.wordpress.com/188/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/6guts.wordpress.com/188/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/6guts.wordpress.com/188/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/6guts.wordpress.com/188/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/6guts.wordpress.com/188/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=6guts.wordpress.com&amp;amp;blog=14597269&amp;amp;post=188&amp;amp;subd=6guts&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://6guts.wordpress.com</uri>
		</author>
		<source>
			<title type="html">6guts</title>
			<subtitle type="html">Tales of Perl 6 guts hacking</subtitle>
			<link rel="self" href="http://6guts.wordpress.com/feed/"/>
			<id>http://6guts.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Rakudo Star 2012.01 released</title>
		<link href="http://rakudo.org/2012/01/28/rakudo-star-2012-01-released/"/>
		<id>http://rakudo.org/?p=113</id>
		<updated>2012-01-28T14:34:19+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;On behalf of the Rakudo and Perl 6 development teams, I’m happy to announce the January 2012 release of “Rakudo Star”, a useful and usable distribution of Perl 6.  The tarball for the January 2012 release is available from &lt;a href=&quot;http://github.com/rakudo/star/downloads&quot;&gt;http://github.com/rakudo/star/downloads&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;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 #48 of the &lt;a href=&quot;http://github.com/rakudo/rakudo&quot;&gt;Rakudo Perl 6 compiler&lt;/a&gt; [1], version 3.11 of the &lt;a href=&quot;http://parrot.org/&quot;&gt;Parrot Virtual Machine&lt;/a&gt; [2], and various modules, documentation, and other resources collected from the Perl 6 community.&lt;/p&gt;
&lt;p&gt;Significantly, this is the first distribution release based on the “nom” (New Object Model) development branch of Rakudo. This work has been carried out with the aim of increasing performance and correctness, as well as providing a better base for taking on a&lt;br /&gt;
range of missing features. Here are some of the major improvements in this release over the previous distribution release.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Greatly improved performance in many areas. For some scripts, this release offers an order of magnitude performance improvement.&lt;/li&gt;
&lt;li&gt;POD6 support, including the $=POD variable to make the POD available at runtime and a –doc option to get at the POD&lt;/li&gt;
&lt;li&gt;The Int type now has big integer semantics&lt;/li&gt;
&lt;li&gt;Initial work on native types, which can be used to write much more efficient code&lt;/li&gt;
&lt;li&gt;LTM-driven protoregexes&lt;/li&gt;
&lt;li&gt;Meta-programming support, including custom meta-classes, overriding method dispatch and much more&lt;/li&gt;
&lt;li&gt; Exception handling is much closer to the specification, and thus much more useful&lt;/li&gt;
&lt;li&gt;Better package handling, including true separate compilation, lexical packages and better nested package handling&lt;/li&gt;
&lt;li&gt;An optimizer, which improves generated code as well as catching a range of issues at compile-time that previously made it to runtime&lt;/li&gt;
&lt;li&gt;Backslash sequences in character classes&lt;/li&gt;
&lt;li&gt;Stubbed methods from roles are now required, providing interface style functionality&lt;/li&gt;
&lt;li&gt;Typed arrays and hashes, as well as supporting for binding to array and hash elements&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Due to improvements in the Perl 6 language specification, and changes to Rakudo to track them, some existing code will need changes. Here are some of the major differences to be aware of.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Attributes can no longer be initialized using “new” unless they are declared as having an accessor; either give them one or write a BUILD submethod&lt;/li&gt;
&lt;li&gt;The proto keyword is no longer used to declare a multi-dispatch fallback&lt;/li&gt;
&lt;li&gt;You may no longer do ‘filename’.lines; use ‘filename’.IO.lines&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We have maintained backwards compatibility with some changed pieces of syntax, but will drop them in an upcoming release:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;“&amp;lt;…&amp;gt;” in proto regex bodies; now this should be written “*”&lt;/li&gt;
&lt;li&gt;The use of “**” with a separator in regexes; this is now done by using “%” or “%%” on another quantifier&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;While this release does contain a great number of improvements, unfortunately we have regressed in a few places. Of note:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Some cases of auto-vivification do not work&lt;/li&gt;
&lt;li&gt;The binding of a capture against a signature literal is broken&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We will be working to restore this functionality for future Rakudo Star releases; if you depend heavily on it, you may wish to stick with the previous Rakudo Star release for&lt;br /&gt;
another month.&lt;/p&gt;
&lt;p&gt;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:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;pack and unpack&lt;/li&gt;
&lt;li&gt;macros&lt;/li&gt;
&lt;li&gt;threads and concurrency&lt;/li&gt;
&lt;li&gt;Unicode strings at levels other than codepoints&lt;/li&gt;
&lt;li&gt;pre and post constraints, and some other phasers&lt;/li&gt;
&lt;li&gt;interactive readline that understands Unicode&lt;/li&gt;
&lt;li&gt;non-blocking I/O&lt;/li&gt;
&lt;li&gt;much of Synopsis 9&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There is a new online resource at &lt;a href=&quot;http://perl6.org/compilers/features&quot;&gt;http://perl6.org/compilers/features&lt;/a&gt; that lists the known implemented and missing features of Rakudo Star 2012.01 and other Perl 6 implementations.&lt;/p&gt;
&lt;p&gt;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 &amp;lt;rakudobug@perl.org&amp;gt;.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&quot;http://perl6.org/&quot;&gt;http://perl6.org/&lt;/a&gt; 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 &amp;lt;docs/UsingPerl6-draft.pdf&amp;gt; in the release tarball.&lt;/p&gt;
&lt;p&gt;The development team thanks all of the contributors and sponsors for making Rakudo Star possible.  If you would like to contribute, see &amp;lt;&lt;a href=&quot;http://rakudo.org/how-to-help&quot;&gt;http://rakudo.org/how-to-help&lt;/a&gt;&amp;gt;, ask on the perl6-compiler@perl.org mailing list, or join us on IRC #perl6 on freenode.&lt;/p&gt;
&lt;p&gt;[1] &lt;a href=&quot;http://github.com/rakudo/rakudo&quot;&gt;http://github.com/rakudo/rakudo&lt;/a&gt;&lt;br /&gt;
[2] &lt;a href=&quot;http://parrot.org/&quot;&gt;http://parrot.org/&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>jnthn</name>
			<uri>http://rakudo.org</uri>
		</author>
		<source>
			<title type="html">rakudo.org</title>
			<subtitle type="html">Rakudo Perl 6</subtitle>
			<link rel="self" href="http://rakudo.org/feed/"/>
			<id>http://rakudo.org</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Looking back, looking forward</title>
		<link href="http://6guts.wordpress.com/2012/01/15/looking-back-looking-forward/"/>
		<id>http://6guts.wordpress.com/?p=178</id>
		<updated>2012-01-15T22:28:47+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;So, 2012 is here, and here’s my first Perl 6 post of the year. Welcome! :-)&lt;/p&gt;
&lt;h3&gt;Looking Back&lt;/h3&gt;
&lt;p&gt;2011 brought us a faster Rakudo with vastly improved meta-programming capabilities, the first work on exploring native types in Perl 6, the start of a powerful type-driven optimizer and many other bits. It also took me to various conferences and workshops, which I greatly enjoyed. I’d like to take a moment to thank everyone involved in all of this!&lt;/p&gt;
&lt;p&gt;This was all great, but slightly tainted by not managing to get a Rakudo Star distribution release out based on a compiler release with all of these improvements. I’d really hoped to get one out in December. So what happened? Simply, there were a certain set of things I wanted to get in place, and while many of them got done, they didn’t all happen. While the compiler releases are time based – we do one every month – the distribution releases are more about stability and continuity. By the time I headed back to the UK to spend Christmas with family, we were still missing a some things I really wanted before a Star release was done. Given the first thing that happened when I started relaxing a little was that I immediately got unwell, I figured I should actually use my break as, well, a break – and come back recharged. So, I did that.&lt;/p&gt;
&lt;h3&gt;So, let’s try again&lt;/h3&gt;
&lt;p&gt;So, the new goal is this month. I’m happy to report that in the week since I’ve got back to things, one of the things I really wanted to sort out is now done: Zavolaj, the native calling library, now does everything the pre-6model version of it did. In fact, it does a heck of a lot more. It’s even &lt;a href=&quot;https://github.com/jnthn/zavolaj/blob/master/README.markdown&quot;&gt;documented now&lt;/a&gt;! It’s also far cleaner; the original implementation was built in the space of a couple of days with mberends++ while I was moving apartment, and was decidedly hacky in places. The missing bits of the NativeCall library were important because they are depended on by MiniDBI, and I really didn’t want to ship a Rakudo Star that can’t connect to a database. So, next up is to make sure that is in working order. I’m not expecting that to be difficult.&lt;/p&gt;
&lt;p&gt;That aside, there were some things to worry about in Rakudo itself. I’ve dealt with some of those things in the last week, and perhaps the one important remaining thing I want to deal with before Star is a nasty regex engine backtracking related bug (I’ve been hoping pmichaud++, the regex engine guru, might appear and magic it away, but it seems it’s going to fall on my plate). But overall, we’re well on track to cut the Star release this month.&lt;/p&gt;
&lt;h3&gt;What’s the direction for the year ahead?&lt;/h3&gt;
&lt;p&gt;During 2011, Rakudo underwent a significant overhaul. It was somewhat painful, at times decidedly not much fun, but ultimately has been very much worth it: many long standing issues have been put to rest, performance has been improved and many things that were once hard to do are now relatively easy or at least accessible.&lt;/p&gt;
&lt;p&gt;I think it goes without saying that we won’t be doing any such wide-ranging overhaul in 2012. :-) The work in 2011 has opened many doors that we have yet to walk through, and 2012 will see us doing that.&lt;/p&gt;
&lt;p&gt;At a high level, here’s what I want:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Less bugs, more stability:&lt;/strong&gt; mostly this is about continuing to work through the ticket queue and fix things, adding tests as bugs are fixed to ensure they stay fixed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Better error reporting:&lt;/strong&gt; there are things in STD, the Perl 6 standard grammar, that allow it to give much more informative error reports on syntax errors than we often can in Rakudo today. I want us to bring these things into Rakudo. Additionally, there’s plenty of improvements to be made in runtime errors. Furthermore, I want to expand the various bits of static analysis that I have started doing in the optimizer to catch a much wider range of errors at compile time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Run programs faster:&lt;/strong&gt; this process is helped by having decent profiling support these days. There’s a lot more to be done here; the optimizer will help, as will code generation improvements.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compile programs faster:&lt;/strong&gt; this will come from more efficient parsing and greatly improving the quality of the code NQP generates (NQP is the language we write much of the compiler in)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shorter startup time:&lt;/strong&gt; this mostly involves finishing the bounded serialization work up. I think the best way to describe this stuff is “fiddly”.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use less memory:&lt;/strong&gt; Rakudo has got faster in no small part thanks to being able to understand its performance through profiling. Our understanding of its memory consumption is much more limited, which makes it harder to target improvements. That said, I’ve some good guesses, and some ideas for analyzing the situation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;More features:&lt;/strong&gt; while being able to do the things Rakudo can do today faster and with less bugs would give a very usable language for quite a lot of tasks, there’s still various features to come. In particular, Rakudo’s support for S05 and S09 needs work.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VM Portability:&lt;/strong&gt; we’ve made good progress towards being able to make a serious stab at this over the last year, while at the same time also managing to perform vastly better on Parrot too. With help from kshannon++, I’m currently working on completing the switch to QRegex (a regex engine with NFA-powered LTM, and written in NQP rather than PIR), which should carry on a pattern of simultaneously increasing performance and portability. Beyond that will be an overhaul of our AST and code generation, with the same goal in mind.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, lot’s of exciting things coming up, and I look forward to blogging about it here. :-)&lt;/p&gt;
&lt;h3&gt;A way to help&lt;/h3&gt;
&lt;p&gt;There are many ways to get involved, depending on what you’re interested in. One way is to take a look at our &lt;a href=&quot;https://rt.perl.org/rt3/Search/Results.html?Rows=50&amp;amp;Page=1&amp;amp;Format=%27%20%20%20%3Cb%3E%3Ca%20href%3D%22%2Frt3%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__id__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3A%23%27%2C%0A%27%3Cb%3E%3Ca%20href%3D%22%2Frt3%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__Subject__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3ASubject%27%2C%0A%27__Status__%27%2C%0A%27__QueueName__%27%2C%0A%27__OwnerName__%27%2C%0A%27__Priority__%27%2C%0A%27__NEWLINE__%27%2C%0A%27%27%2C%0A%27%3Csmall%3E__Requestors__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__CreatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__ToldRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__LastUpdatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__TimeLeft__%3C%2Fsmall%3E%27&amp;amp;Query=%20%20%28%20%20Status%20%3D%20%27new%27%20OR%20Status%20%3D%20%27open%27%20%29%20AND%20Queue%20%3D%20%27perl6%27%20AND%20%27CF.{Tag}%27%20LIKE%20%27%25testneeded%25%27&amp;amp;Order=ASC|ASC|ASC|ASC&amp;amp;OrderBy=id|||&quot;&gt;fixed bugs that need tests writing&lt;/a&gt;. At the time of writing, just short of 100 tickets are in this state. No guts-y knowledge needed for this – you just need to understand enough Perl 6 (or be willing to learn enough) to know what the ticket is about and how to write a test for it. Drop by #perl6 for hints. :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/178/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/6guts.wordpress.com/178/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/6guts.wordpress.com/178/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/6guts.wordpress.com/178/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/6guts.wordpress.com/178/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/6guts.wordpress.com/178/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/6guts.wordpress.com/178/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/6guts.wordpress.com/178/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/6guts.wordpress.com/178/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/6guts.wordpress.com/178/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/6guts.wordpress.com/178/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/6guts.wordpress.com/178/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/6guts.wordpress.com/178/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/6guts.wordpress.com/178/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=6guts.wordpress.com&amp;amp;blog=14597269&amp;amp;post=178&amp;amp;subd=6guts&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://6guts.wordpress.com</uri>
		</author>
		<source>
			<title type="html">6guts</title>
			<subtitle type="html">Tales of Perl 6 guts hacking</subtitle>
			<link rel="self" href="http://6guts.wordpress.com/feed/"/>
			<id>http://6guts.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Last Piece of Pi</title>
		<link href="http://justrakudoit.wordpress.com/2012/01/15/last-piece-of-pi/"/>
		<id>http://justrakudoit.wordpress.com/?p=386</id>
		<updated>2012-01-15T17:43:08+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;So, last spring I did a &lt;a href=&quot;http://justrakudoit.wordpress.com/2011/04/27/an-infinite-stream-of-pi/&quot;&gt;series of posts&lt;/a&gt; on making a Pi spigot.  Unfortunately, the project foundered a bit, as it turned out that only Rakudo had the subsignatures needed to make the code pretty, but only Niecza had the big integers needed to make the code work.&lt;/p&gt;
&lt;p&gt;Fast forward to today.  Now both Rakudo and Niecza can handle &lt;a href=&quot;http://rosettacode.org/wiki/Pi#Perl_6&quot;&gt;the best version of the code&lt;/a&gt; with no problem!&lt;/p&gt;
&lt;p&gt;Let me emphasize that again.  A year ago, neither implementation had those two features.  Eight months ago, each had one.  Today both have both.  What’s more, Rakudo seems to have made some pretty impressive speed improvements.&lt;/p&gt;
&lt;p&gt;I think the awkward situation with Rakudo Star has helped obscure the fantastic good news in Perl 6.  &lt;strong&gt;Right now we have two distinct Perl 6 implementations, each of which is markedly better than anything available a year ago.&lt;/strong&gt;  While there are still some rough edges, both implementations are making visible progress every single day.&lt;/p&gt;
&lt;p&gt;Okay, enough cheerleading.  Time to finish the Pi story.  It turned out there was one last complication.  I had never actually tried to use the code to generate an infinite stream of Pi.  I always stopped at 40 digits.  Confident that the algorithm must work, I tweaked the output to just continue generating digits until you stopped the program with control-C.  And I ran it using Niecza, and it printed&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;3.14159265358979323846264338327950288419716
9399375105820974944592307816406286208998628
0348253421170679821480865
&lt;/pre&gt;&lt;br /&gt;
And then it just sat there, calculating.  After a few minutes I stopped it and tried it in Rakudo, and got the exact same result.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Well, after adding a few debugging &lt;code&gt;say&lt;/code&gt;s here and there, I found the problem.  The &lt;code&gt;extr&lt;/code&gt; sub was returning &lt;code&gt;NaN&lt;/code&gt;.  It turns out that both compilers have issues with dividing huge numbers.  Here’s the division operation that was causing the problem:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;826855066209083067690330954944954674053
707782399091459328155002954168455127712
564546723209828068849110223672691692080
858850302237001093531862737473606364113
314687502675869281622802970765988449203
963736097729699655628829895255493809983
868753943269929165690008254816168624365
041070395716948346309925280258763697273
816643106559428329680316113883598846477
019844021876290510680558354153412094804
165563855909020631086890050609449881578
622437959410200560054513816596644762131
226627968813825552929967132893776980417
525678140579476414867767644626389410380
794467097761379794479928269796859019439
705966555011741254554959832606241504043
482378842096776403191455346497512084739
323724281071973237937801014210278895804
940475966938880398182275335278425442994
287812050560074302564177393567873480740
249095636709741437469651121924884638352
523975466249955052660310789169884060356
70777782797813415527343750 / 7640045443
915776552858245682965495041201868477244
923723289802372673948570989301189643881
881673616027696317656701576457227272117
067947294675092324411286583110995372015
785893970194452345100095389207557064515
618905243737091067059065039684867000766
465399984513882758095027633673968549038
659642193965599458094646356792444696562
299054844575814305259223023977803302735
242307789179027935107449661143998428584
590618630170775872761731454567203230484
311106708425828778192240791257477924515
937573923664112071637127786446287936043
637833776529791999568414593746973068229
015816020732598109749879566833692821582
816119454436978125677364775318707235283
939392855143663977524974469973442065855
128922452382372338686111634084367257050
255499210918328304009454606504169283500
652033488755998721320134300149134205253
095344802815192912405314659633341062491
389270940370884860337596933277382049709
5584869384765625
&lt;/pre&gt;&lt;br /&gt;
Turns out the bottom number is bigger than can be presented by a &lt;code&gt;Num&lt;/code&gt;, so the division operation ends up becoming &lt;code&gt;N / Inf&lt;/code&gt;, which is &lt;code&gt;NaN&lt;/code&gt;.  This is a bit obscured in Rakudo because the division operation actually returns a &lt;code&gt;Rat&lt;/code&gt; (which should be illegal according to the spec!), but then &lt;code&gt;.floor&lt;/code&gt; is called on the result, which tries to convert to &lt;code&gt;Num&lt;/code&gt; before doing the floor operation.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This opens several questions, like: Should Perl 6′s &lt;code&gt;Int / Int&lt;/code&gt; operator be modified to try to cope with this sort of case?&lt;/p&gt;
&lt;p&gt;But for the Pi problem, the good news is this: every time the &lt;code&gt;extr&lt;/code&gt; sub is called, its result is fed to &lt;code&gt;.floor&lt;/code&gt;.  That means we simply needed to replace &lt;code&gt;/&lt;/code&gt; with &lt;code&gt;div&lt;/code&gt; and get rid of the &lt;code&gt;.floor&lt;/code&gt;s.&lt;/p&gt;
&lt;p&gt;And with that, &lt;a href=&quot;http://rosettacode.org/wiki/Pi#Perl_6&quot;&gt;the code&lt;/a&gt; easily produces 2,000+ digits of Pi using either Rakudo or Niecza!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/justrakudoit.wordpress.com/386/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/justrakudoit.wordpress.com/386/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/justrakudoit.wordpress.com/386/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/justrakudoit.wordpress.com/386/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/justrakudoit.wordpress.com/386/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/justrakudoit.wordpress.com/386/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/justrakudoit.wordpress.com/386/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/justrakudoit.wordpress.com/386/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/justrakudoit.wordpress.com/386/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/justrakudoit.wordpress.com/386/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/justrakudoit.wordpress.com/386/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/justrakudoit.wordpress.com/386/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/justrakudoit.wordpress.com/386/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/justrakudoit.wordpress.com/386/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=justrakudoit.wordpress.com&amp;amp;blog=12219098&amp;amp;post=386&amp;amp;subd=justrakudoit&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>colomon</name>
			<uri>http://justrakudoit.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Just Rakudo It</title>
			<subtitle type="html">I Never Metaop I Didn't Like</subtitle>
			<link rel="self" href="http://justrakudoit.wordpress.com/feed/"/>
			<id>http://justrakudoit.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">State of Dancer on Perl 6</title>
		<link href="http://ttjjss.wordpress.com/2012/01/06/state-of-dancer-on-perl-6/"/>
		<id>http://ttjjss.wordpress.com/?p=135</id>
		<updated>2012-01-06T00:24:34+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;&lt;a href=&quot;https://github.com/tadzik/bailador&quot;&gt;Bailador&lt;/a&gt; is growing better and bigger and starts to resemble a real tool more and more. Let’s see what new features it has gained recently.&lt;/p&gt;
&lt;p&gt;Remember the first example in &lt;code&gt;perldoc Dancer&lt;/code&gt;? It’s not really different in Bailador:&lt;/p&gt;
&lt;pre&gt;use Bailador;
get '/hello/:name' =&amp;gt; sub ($name) {
    return &quot;Why, hello there $name&quot;
}
baile;&lt;/pre&gt;
&lt;p&gt;Aside of being a little Spanished, what did it give us? We have subroutine signatures in Perl 6 so we can pass the :name parameter to the sub; there’s no need to use &lt;code&gt;param()&lt;/code&gt; now: it’s gone.&lt;/p&gt;
&lt;p&gt;You don’t need to pass everything using GET of course. post keyword is also supported.&lt;/p&gt;
&lt;pre&gt;post '/' =&amp;gt; sub {
    return request.params.perl
}&lt;/pre&gt;
&lt;p&gt;The above will print something like &lt;code&gt;(&quot;foo&quot; =&amp;gt; &quot;bar&quot;).hash&lt;/code&gt;, if fed with appropriate request.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;any()&lt;/code&gt; is a reserved keyword in Perl 6, and while you can use it, it means a completely different thing. Instead of &lt;code&gt;any('get', 'post')&lt;/code&gt; you can just do it like this:&lt;/p&gt;
&lt;pre&gt;&lt;strong&gt;get post&lt;/strong&gt; '/' =&amp;gt; sub {
    if request.is_get {
        return &quot;I am GET&quot;
    } else {
        return request.params.perl
    }
}&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;post&lt;/code&gt;, as well as &lt;code&gt;get&lt;/code&gt; return their arguments, so you can chain them like in the example above. It also shows the joy of &lt;code&gt;request&lt;/code&gt; object, which you can use to inspect the request being processed. It’s not as cool as Dancer::Request, but it does the job, &lt;a href=&quot;https://github.com/tadzik/Bailador/blob/master/lib/Bailador/Request.pm&quot;&gt;being quite small and simple&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;What else do we have? Let’s show off a bit and write a simple-simple pastebin webapp.&lt;/p&gt;
&lt;pre&gt;use Bailador;

unless 'data'.IO ~~ :d {
    mkdir 'data'
}

get '/' =&amp;gt; sub {
    template 'index.tt'
}

post '/new_paste' =&amp;gt; sub {
    my $t  = time;
    my $c = request.params&amp;lt;content&amp;gt;;
    unless $c {
        return &quot;No empty pastes please&quot;;
    }
    my $fh = open &quot;data/$t&quot;, :w;
    $fh.print: $c;
    $fh.close;
    return &quot;New paste available at paste/$t&quot;;
}

get /paste\/(.+)/ =&amp;gt; sub ($tag) {
    content_type 'text/plain';
    if &quot;data/$tag&quot;.IO.f {
        return slurp &quot;data/$tag&quot;
    }
    status 404;
    return &quot;Paste does not exist&quot;;
}

baile;&lt;/pre&gt;
&lt;p&gt;Holy cow, what’s that! Let’s go there piece by piece. First, we’ll create a &lt;code&gt;data&lt;/code&gt; directory if it doesn’t already exist. No black magic here, let’s proceed. What’s next? Templates! Here we just load &lt;code&gt;index.tt&lt;/code&gt;, not passing any parameters, but that works too and &lt;a href=&quot;https://github.com/tadzik/Bailador/blob/master/examples/app.pl#L31&quot;&gt;some example apps&lt;/a&gt; use that in &lt;a href=&quot;https://github.com/tadzik/Bailador/blob/master/examples/views/tmpl.tt&quot;&gt;their example templates&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The handler of &lt;code&gt;new_paste&lt;/code&gt; uses our well-known &lt;code&gt;request&lt;/code&gt; object again, and creates a new file for a paste, identified by the current time.&lt;/p&gt;
&lt;p&gt;The last &lt;code&gt;get&lt;/code&gt; block uses some nifty features, so let’s take a look. It uses regexes, and you can see that they also cooperate with subroutine parameters without black magic. We then set a &lt;code&gt;content_type&lt;/code&gt; as we’ll do in Dancer, and send &lt;code&gt;status 404&lt;/code&gt; if no paste have been found. Easy peasy? I suppose so. That’s it, it works like a charm.&lt;/p&gt;
&lt;p&gt;Thus we’ve covered all the features in Bailador as for now. I don’t think it’s that poor, as for about 100 lines of code.&lt;/p&gt;
&lt;p&gt;What’s next? What’s missing? You tell me. Or you contribute; the code is dead simple and implementing stuff like &lt;code&gt;before()&lt;/code&gt;, &lt;code&gt;after()&lt;/code&gt;, &lt;code&gt;before_template()&lt;/code&gt; etc should be a matter of 3-5 lines, I think. Feel encouraged to look into the code and hack on it. If you have any questions, suggestions or criticism, don’t hesitate to tell, or poke me on #perl @ Freenode. Have fun!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/ttjjss.wordpress.com/135/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/ttjjss.wordpress.com/135/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/ttjjss.wordpress.com/135/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/ttjjss.wordpress.com/135/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/ttjjss.wordpress.com/135/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/ttjjss.wordpress.com/135/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/ttjjss.wordpress.com/135/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/ttjjss.wordpress.com/135/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/ttjjss.wordpress.com/135/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/ttjjss.wordpress.com/135/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/ttjjss.wordpress.com/135/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/ttjjss.wordpress.com/135/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/ttjjss.wordpress.com/135/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/ttjjss.wordpress.com/135/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=ttjjss.wordpress.com&amp;amp;blog=15099040&amp;amp;post=135&amp;amp;subd=ttjjss&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>ttjjss</name>
			<uri>http://ttjjss.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Whatever but Cool » Perl</title>
			<link rel="self" href="http://ttjjss.wordpress.com/category/perl/feed/"/>
			<id>http://ttjjss.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 in 2011 - A Retrospection</title>
		<link href="http://perlgeek.de/blog-en/perl-6/perl-6-in-2011.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/perl-6-in-2011.html</id>
		<updated>2011-12-31T18:00:00+00:00</updated>
		<content type="html">&lt;p&gt;The change of year is a good occasion to look back. Here I want to
reflect on the development of Perl 6, its compilers and ecosystem.&lt;/p&gt;

&lt;p&gt;At the start of the year, masak's &lt;a href=&quot;http://strangelyconsistent.org/p6cc2010/&quot;&gt;Perl 6 Coding Contest&lt;/a&gt;
continued from 2010, concluding in the &lt;a href=&quot;http://strangelyconsistent.org/blog/announcing-the-winner-of-p6cc2010&quot;&gt;announcement
of the winner&lt;/a&gt;. I must admit that I still haven't read all the books I
won :-)&lt;/p&gt;

&lt;h2&gt;Specification&lt;/h2&gt;

&lt;p&gt;2011 was a rather quiet year in terms of spec changes; they were a
mixture of responses to compiler writer and user feedback, and
some simplifications and cleanups.&lt;/p&gt;

&lt;p&gt;Positional parameters used to be allowed to be called by name; this
feature is now gone. That both makes the signature binder simpler, and
removes accidental dependencies on names that weren't meant to be public.
Read the &lt;a href=&quot;https://gist.github.com/984783&quot;&gt;full justification&lt;/a&gt;
for more background.&lt;/p&gt;

&lt;p&gt;A small change that illustrates the cleanup of old, p5-inherited features
was the change that &lt;a href=&quot;https://github.com/perl6/specs/commit/e84b11137cc55ecd9f17f58976c08d361054ea05&quot;&gt;made
&amp;amp;eval stop catching exceptions&lt;/a&gt;. There is really no good reason for it
to catch them, except Perl 5 legacy.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;say&lt;/code&gt; now uses a different stringification than
&lt;code&gt;print&lt;/code&gt;. The reasoning is that &lt;code&gt;print&lt;/code&gt; is aimed at
computer-readable output, whereas &lt;code&gt;say&lt;/code&gt; is often used for
debugging. As an example, undefined values stringify to the empty string
(and produce a warning), whereas &lt;code&gt;say&lt;/code&gt; calls the &lt;code&gt;.gist&lt;/code&gt;
method on the object to be said, which produces the type name on undefined
values.&lt;/p&gt;

&lt;p&gt;An area that has been greatly solidified due to implementation progress is
&lt;em&gt;Plain Old Documentation&lt;/em&gt; or &lt;em&gt;Pod&lt;/em&gt;. Tadeusz Sośnierz' Google
Summer of Code project ironed out many wrinkles and inconsistencies, and
changed my perception of this part of the spec from &quot;speculative&quot; to &quot;under
development&quot;.&lt;/p&gt;

&lt;h2&gt;Rakudo&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://rakudo.org/&quot;&gt;Rakudo&lt;/a&gt; underwent a huge refactoring this year; it is now &lt;a href=&quot;http://pmthium.com/2011/02/08/new-nqp-repository-new-nom-rakudo-branch/&quot;&gt;bootstrapped
by a new compiler called &quot;nqp&quot;, and uses a new object model&lt;/a&gt; (nom).&lt;/p&gt;

&lt;p&gt;It allows us to gain speed and memory advantages from gradual typing; for
example the &lt;a href=&quot;https://github.com/colomon/mandelbrot/blob/master/bin/mandelbrot-color.pl&quot;&gt;mandelbrot
fractral generator&lt;/a&gt; used to take 18 minutes to run on a machine of mine,
and now takes less than 40 seconds. Speedups in other areas are not as big,
but there is still much room for improvement in the optimizer.&lt;/p&gt;

&lt;p&gt;With the nom branch came support for different object representations. It
makes it possible to store object attributes in simple C-like structs, which
in turn makes it much easier and more convenient to &lt;a href=&quot;https://github.com/jnthn/zavolaj/&quot;&gt;interoperate with C
libraries&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Tadeusz' work on Pod gave Rakudo support for converting Pod to plain text
and HTML, and attach documentation objects to routines and other objects.&lt;/p&gt;

&lt;p&gt;Rakudo now also has lazy lists, much better role handling, &lt;a href=&quot;http://news.perlfoundation.org/2011/02/hague-grant-application-struct.html&quot;&gt;typed
exceptions for a few errors&lt;/a&gt;, the &lt;code&gt;-n&lt;/code&gt; and &lt;code&gt;-p&lt;/code&gt; command
line options, support for big integers, NFA-based support for proto regexes
and improvements to many built-in functions, methods and operators.&lt;/p&gt;


&lt;h2&gt;Niecza&lt;/h2&gt;

&lt;p&gt;It is hard to accurately summarize the development of &lt;a href=&quot;https://github.com/sorear/niecza/&quot;&gt;Niecza&lt;/a&gt; in a few
sentences; instead of listing the many, many new features I should give
an impression on how it feels and felt for the user.&lt;/p&gt;

&lt;p&gt;At the start of 2011, programming in niecza was a real adventure. Running 
some random piece of Perl 6 code that worked with Rakudo rarely worked, most
of the time it hit a missing built-in, feature or bug.&lt;/p&gt;

&lt;p&gt;Now it often just works, and usually much faster than in Rakudo. There are
still some missing features, but Stefan O'Rear and his fellow contributors
work tirelessly on catching up to Rakudo, and it some areas Niecza is clearly
ahead (for example Unicode support in regexes, and longest-token
matching).&lt;/p&gt;

&lt;p&gt;Since Niecza is implemented on top of the Common Language Runtime (CLR)
(which means .NET or mono), it makes it easy to use existing CLR-based
libraries. Examples include &lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/17/day-17-gtk-mandelbrot/&quot;&gt;an
interactive fractal generator&lt;/a&gt; and a small &lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/05/tetris-on-niecza/&quot;&gt;Tetris
game in Perl 6.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Perlito&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://www.perlito.org/&quot;&gt;Perlito&lt;/a&gt; aims to be a minimal compiler
with multiple backends, which can be used for embedding and experimenting with
Perl 6. It had several releases in 2011, and has interesting features like a
Javascript backend.&lt;/p&gt;

&lt;h2&gt;Ecosystem&lt;/h2&gt;

&lt;p&gt;The presence of two usable compilers (and in the case of Rakudo, two viable
but very different branches) has led to many questions about the different
compilers. The new &lt;a href=&quot;http://perl6.org/compilers/features&quot;&gt;Perl 6
Compiler Feature matrix&lt;/a&gt; tries to answer the questions about the state of
the implemented features in the compilers.&lt;/p&gt;

&lt;p&gt;With &lt;a href=&quot;https://github.com/tadzik/panda/&quot;&gt;Panda&lt;/a&gt; we now have a
module installer that actually works with Rakudo. It still has some lengths to
go in terms of stability and feature completeness, but it is fun to work
with.&lt;/p&gt;

&lt;p&gt;The new &lt;a href=&quot;http://modules.perl6.org/&quot;&gt;Perl 6 Modules&lt;/a&gt; page gives
an overview of existing Perl 6 modules; we hope to evolve it into a real CPAN
equivalent.&lt;/p&gt;

&lt;h2&gt;Community&lt;/h2&gt;

&lt;p&gt;This year we had another &lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/01/perl-6-advent-calendar-2011/&quot;&gt;Perl
6 Advent Calendar&lt;/a&gt;, with much positive feedback both from the Perl 6
community and the wider programming community.&lt;/p&gt;

&lt;p&gt;We were also happy to welcome several new prolific contributors to the Perl
6 compilers and modules. The atmosphere in the community still feels relaxed,
friendly and productive -- I quite enjoy it.&lt;/p&gt;

&lt;p&gt;The year ends like it started: with a &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;Perl
6 Coding Contest&lt;/a&gt;. This is a good opportunity to dive into Perl 6, provide
feedback to compiler writers, and most of all have fun.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html">The -c flag</title>
		<link href="http://strangelyconsistent.org/blog/the-c-flag"/>
		<id>tag:strangelyconsistent.org,2011-12-28:blog/the-c-flag</id>
		<updated>2011-12-28T20:49:17+00:00</updated>
		<content type="html">&lt;p&gt;The p6cc contest is underway. Yay.&lt;/p&gt;

&lt;p&gt;[Coke]++ discovered on the channel that Rakudo nom didn't have a &lt;code&gt;-c&lt;/code&gt; flag. The five &lt;code&gt;base-test&lt;/code&gt; files all syntax-check the corresponding &lt;code&gt;code&lt;/code&gt; files using the &lt;code&gt;-c&lt;/code&gt; flag. Which made Rakudo nom and the &lt;code&gt;base-test&lt;/code&gt; files incompatible. Oh noes.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;moritz&amp;gt; moritz-- # not reviewing the test harness properly
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The fault is even more mine, of course, since I &lt;em&gt;wrote&lt;/em&gt; the test harness. And I may be an &quot;early adopter&quot; with Perl 6, but I'm always very late at switching over to a new Rakudo branch.&lt;/p&gt;

&lt;p&gt;I was late at switching over to &lt;code&gt;ng&lt;/code&gt;, back when it was still called &lt;code&gt;ng&lt;/code&gt;. And I'm late this time in switching over from &lt;code&gt;b&lt;/code&gt; (the new name for &lt;code&gt;ng&lt;/code&gt;, since the &lt;code&gt;n&lt;/code&gt; stands for &quot;new&quot; and &lt;code&gt;ng&lt;/code&gt; isn't new anymore) to &lt;code&gt;nom&lt;/code&gt; (the new &quot;new&quot;).&lt;/p&gt;

&lt;p&gt;I'll take the leap any day now, I promise.&lt;/p&gt;

&lt;p&gt;moritz++ was quick in patching up the &lt;code&gt;-c&lt;/code&gt; omission.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;dalek&amp;gt; rakudo/nom: a9bead6 | moritz++ | src/ (2 files):
&amp;lt;dalek&amp;gt; rakudo/nom: reimplement -c command line option
&amp;lt;dalek&amp;gt; rakudo/nom: review: https://github.com/rakudo/rakudo/commit/a9bead6d48
&amp;lt;moritz&amp;gt; masak: there you go
&amp;lt;masak&amp;gt; moritz++
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;What this means in practice is: you can't use the latest Rakudo nom compiler release to solve the p6cc problems. Not without modifying the &lt;code&gt;base-test&lt;/code&gt; files anyway. But you &lt;em&gt;can&lt;/em&gt; use the bleeding-edge git checkout of the nom branch.&lt;/p&gt;

&lt;p&gt;If you're on either Niecza or Rakudo b, things should be fine: those have a working &lt;code&gt;-c&lt;/code&gt; flag already.&lt;/p&gt;

&lt;p&gt;Those are the breaks. Perl 6 is evolving, and the mat is constantly being pulled out from under us. To keep up, one has to do a jig now and then.&lt;/p&gt;

&lt;p&gt;We added a &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/NOTES&quot;&gt;&lt;code&gt;NOTES&lt;/code&gt;&lt;/a&gt; file to keep track of information of this kind that we didn't manage to get into the contest instructions.&lt;/p&gt;

&lt;p&gt;On the channel, we also had some nice concluding discussion about the nature of the &lt;code&gt;-c&lt;/code&gt; flag.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;moritz&amp;gt; to me it felt a bit like a cheat
&amp;lt;moritz&amp;gt; because there is already some mechanism for specifying the target stage
&amp;lt;moritz&amp;gt; but it's too tightly coupled to the output from the existing stages to
         be easily usable
&amp;lt;moritz&amp;gt; so I feel like hijacking an existing mechanism
&amp;lt;masak&amp;gt; I guess.
&amp;lt;masak&amp;gt; in some sense, &quot;checking syntax&quot; isn't so much of a compiler stage as...
        a decision not to go past a certain compiler stage.
&amp;lt;TimToady&amp;gt; in a sense, -c adds the final CHECK, that just exits with status
&amp;lt;masak&amp;gt; right.
&amp;lt;TimToady&amp;gt; it can even be implemented that way, since CHECKS do lifo order
&amp;lt;masak&amp;gt; &quot;everything turns out to be yet another setting&quot; :)
&amp;lt;TimToady&amp;gt; yes, it could also be done with a variant setting, but that seems
           a bit heavyweight
&amp;lt;TimToady&amp;gt; otoh, it would be possible to sneak CHECK pushes in before the -c,
           so maybe a setting is the cleaner way
&lt;/code&gt;&lt;/pre&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Announce: Niecza Perl 6 v13 by Stefan O'Rear</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2011/12/msg666.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2011/12/msg666.html</id>
		<updated>2011-12-26T15:55:30+00:00</updated>
		<content type="html">&lt;br /&gt;    Announce: Niecza Perl 6 v13&lt;br /&gt;&lt;br /&gt;This is the thirteenth release of Niecza Perl 6, as usual scheduled on&lt;br /&gt;the last Monday of the month.  I'm on winter break now, which means lots&lt;br /&gt;of time for improvements.  Muahahaha.  A large portion of the improvements&lt;br /&gt;have been in regular expression support.&lt;br /&gt;&lt;br /&gt;Will Coleda and Solomon Foster are working on fudging spectests so they run on&lt;br /&gt;Niecza; between that and actual improvements, we've gained 5000+ working&lt;br /&gt;spectests since the last release.  See [4] for a dramatic visual.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can obtain a build of Niecza from [1].  This build contains a&lt;br /&gt;working compiler as a set of .exe and .dll files suitable for use with&lt;br /&gt;Mono or Microsoft .NET.  If you wish to follow latest developments,&lt;br /&gt;you can obtain the source from [2]; however, you will still need a&lt;br /&gt;binary for bootstrapping, so you gain nothing from a &quot;source is&lt;br /&gt;better&quot; perspective.&lt;br /&gt;&lt;br /&gt;Niecza is a Perl 6 compiler project studying questions about the&lt;br /&gt;efficient implementability of Perl 6 features.  It currently targets&lt;br /&gt;the Common Language Runtime; both Mono and Microsoft .NET are known to&lt;br /&gt;work.  On Windows, Cygwin is required for source builds only; see the&lt;br /&gt;README for details.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    List of changes&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Breaking changes]&lt;br /&gt;&lt;br /&gt;/ &amp;lt;{ foo }&amp;gt; / is no longer accepted as a synonym for / &amp;lt;?{ foo }&amp;gt; /.&lt;br /&gt;&lt;br /&gt;$0 is no longer allowed to mean $/ when there is no capture zero.&lt;br /&gt;&lt;br /&gt;$/.ast no longer defaults to ~$/.  Use $() if you want that.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Major features]&lt;br /&gt;&lt;br /&gt;New-style character class expressions like &amp;lt;:Uppercase &amp;amp; :Greek&amp;gt; are&lt;br /&gt;now supported.&lt;br /&gt;&lt;br /&gt;Unicode property access is now supported!  In addition to the use in&lt;br /&gt;regexes, there is also a minimal Niecza::UCD module which allows querying&lt;br /&gt;the properties of characters.  All non-Unihan properties defined in&lt;br /&gt;Unicode 6.0.0 are available.&lt;br /&gt;&lt;br /&gt;Runtime number parsing has been radically extended and now supports the&lt;br /&gt;full gamut of Perl 6 number syntaxes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Minor features]&lt;br /&gt;&lt;br /&gt;Supplementary characters are now generally supported, though StrPos-type&lt;br /&gt;counting for chars, substr, etc is still in UTF-16 code units.&lt;br /&gt;&lt;br /&gt;codes is now available, for when you need to actually count code points&lt;br /&gt;(be aware that it is O(n)).&lt;br /&gt;&lt;br /&gt;The regex infix operators &amp;amp; and &amp;amp;&amp;amp; are now supported (currently treated&lt;br /&gt;as synonyms, but don't rely on this).&lt;br /&gt;&lt;br /&gt;&amp;amp;pow is a little bit smarter and needlessly returns NaN in fewer cases&lt;br /&gt;(Solomon Foster, Stefan O'Rear).&lt;br /&gt;&lt;br /&gt;Imported a few tweaks from STD, including a better message for say$_.&lt;br /&gt;&lt;br /&gt;\h \v \s \w and \d now use the recommended UTS18[3] definitions.&lt;br /&gt;&lt;br /&gt;\n, $$, and ^^ now match any vertical whitespace, including CRLF as&lt;br /&gt;a single unit.&lt;br /&gt;&lt;br /&gt;% is now supported for all quantifiers and %% is available too.&lt;br /&gt;&lt;br /&gt;$() @() %() are now supported.&lt;br /&gt;&lt;br /&gt;/$var/ now allows $var to be a Regex.  Likewise /&amp;lt;$var&amp;gt;/, /@var/,&lt;br /&gt;and /&amp;lt;@var&amp;gt;/ have been added.  / &amp;lt;{...}&amp;gt; / now does the right thing.&lt;br /&gt;&lt;br /&gt;The implementation of $&amp;lt;foo&amp;gt;=[...] has been considerably simplified&lt;br /&gt;and depessimized.&lt;br /&gt;&lt;br /&gt;/ &amp;lt;.$foo&amp;gt; / assertion syntax is now supported.&lt;br /&gt;&lt;br /&gt;/ &amp;lt;foo&amp;gt; / will now call a lexical &quot;my regex foo&quot; if possible.  To minimize&lt;br /&gt;potential accidents, this applies ONLY to regexes, tokens, and rules;&lt;br /&gt;despite using the same namespace, a &quot;my sub foo&quot; will not be called.&lt;br /&gt;&lt;br /&gt;/ &amp;lt;&amp;amp;foo(...)&amp;gt; / now allows arguments.&lt;br /&gt;&lt;br /&gt;@&amp;lt;foo&amp;gt; now correctly contextualizes.&lt;br /&gt;&lt;br /&gt;Nontrivial regex protos, like &quot;proto regex foo { &quot;bar&quot; {*} }&quot;, are now&lt;br /&gt;implemented.&lt;br /&gt;&lt;br /&gt;&amp;lt;( and )&amp;gt; are now supported.&lt;br /&gt;&lt;br /&gt;Added Match methods: kv, keys, values, caps, chunks, prematch, postmatch.&lt;br /&gt;&lt;br /&gt;Added \c[] syntax in strings and regexes.&lt;br /&gt;&lt;br /&gt;Rat and FatRat now stringify as fractions.&lt;br /&gt;&lt;br /&gt;Inf now stringifies as &quot;Inf&quot; rather than leaking C# Infinity.&lt;br /&gt;&lt;br /&gt;Added predefined quasi-property rules like &amp;lt;alnum&amp;gt;.&lt;br /&gt;&lt;br /&gt;Added Niecza::Benchmark, providing the barest minimum of functionality like&lt;br /&gt;Perl 5's &quot;Benchmark&quot;.&lt;br /&gt;&lt;br /&gt;Inf, NaN correctly handled in rounding, Cool.truncate, &amp;amp;kv, Pair.invert,&lt;br /&gt;&amp;amp;srand, allow :x(*) in subst, .chr, .ord, .chrs, .ords, &amp;amp;chrs, &amp;amp;ords,&lt;br /&gt;trim methods, &amp;amp;roll, .roll(*), end, min, max, minmax (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Added .pick(*), corrected Str and Numeric for Range (Will Coleda)&lt;br /&gt;&lt;br /&gt;classify (Moritz Lenz)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Selected bug fixes]&lt;br /&gt;&lt;br /&gt;Threads.pm6 is working again, now with exception-safe locking.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Other]&lt;br /&gt;&lt;br /&gt;There is now documentation on how to prepare releases.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Getting involved&lt;br /&gt;&lt;br /&gt;Contact sorear in irc.freenode.net #perl6 or via the sender address of&lt;br /&gt;this mailing.  Also check out the TODO file; whether you want to work&lt;br /&gt;on stuff on it, or have cool ideas to add to it, both are good.&lt;br /&gt;&lt;br /&gt;    Future directions&lt;br /&gt;&lt;br /&gt;My current priorities are:&lt;br /&gt; 1. Make regexes much more feature-complete, including general Unicode&lt;br /&gt;    properties and grapheme mode&lt;br /&gt; 2. Prototype the debugger&lt;br /&gt; 3. 6model convergence work, including roles/native types&lt;br /&gt; 4. Figure out how modules and S11 stuff should work in Niecza.  Do it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[1] https://github.com/downloads/sorear/niecza/niecza-13.zip&lt;br /&gt;[2] https://github.com/sorear/niecza&lt;br /&gt;[3] http://www.unicode.org/reports/tr18/&lt;br /&gt;[4] https://github.com/flussence/specgraphs/raw/master/impls.png&lt;br /&gt;&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 25 – Merry Christmas!</title>
		<link href="http://perl6advent.wordpress.com/2011/12/25/day-25-merry-christmas/"/>
		<id>http://perl6advent.wordpress.com/?p=1078</id>
		<updated>2011-12-25T10:52:41+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;The kind elves who spend the rest of the year working in Santa’s shop to bring you more of Perl 6 each year would like to wish you a very warm and fuzzy Christmas vacation. December is always a special time for us, because we get to interact with you all through the interface of the advent calendar. We think that’s wonderful.&lt;/p&gt;
&lt;p&gt;Be sure to check out this year’s &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;Perl 6 coding contest&lt;/a&gt;, where you can win €100 worth of books!&lt;/p&gt;
&lt;p&gt;Merry Christmas!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1078/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/1078/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/1078/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/1078/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/1078/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/1078/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/1078/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/1078/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/1078/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/1078/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/1078/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/1078/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/1078/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/1078/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=1078&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>carl</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">The 2011 Perl 6 Coding Contest</title>
		<link href="http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest"/>
		<id>tag:strangelyconsistent.org,2011-12-25:blog/the-2011-perl-6-coding-contest</id>
		<updated>2011-12-25T10:20:17+00:00</updated>
		<content type="html">&lt;p&gt;With slightly less gratuitous buildup of expectations this year, but with no less grandeur and excitement, we're proud to announce:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;&lt;center&gt;&lt;strong&gt;The 2011 Perl 6 Coding Contest&lt;/strong&gt;&lt;/center&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Today there's two of us arranging the contest: the esteemed &lt;a href=&quot;http://perlgeek.de/&quot;&gt;Moritz Lenz&lt;/a&gt;, and me. Hello.&lt;/p&gt;

&lt;p&gt;This is a contest for people who &lt;em&gt;are&lt;/em&gt; aware that Perl 6 has been &quot;officially released&quot;, and who want the perfect excuse to start playing around with the language. As the Perl 6 community steadily works its way towards production-readiness, we can already enjoy ourselves royally by solving interesting Computer Science problems!&lt;/p&gt;

&lt;p&gt;Here's the deal:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;&lt;center&gt;&lt;strong&gt;do five tasks, and you might win Amazon books worth €100!&lt;/strong&gt;&lt;/center&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Addendum:&lt;/strong&gt; Thanks to an anonymous donor, we're very happy to announce that there is now a &lt;em&gt;second&lt;/em&gt; prize too: Amazon books worth 100 USD!&lt;/p&gt;

&lt;p&gt;The contest starts &lt;em&gt;now&lt;/em&gt;, today on 2011-12-25. It ends five weeks later, on 2012-01-29. Registration is open for two weeks, starting &lt;em&gt;now&lt;/em&gt;. Just send an email to &lt;code&gt;cmasak@gmail.com&lt;/code&gt; — saying &quot;sign me up!&quot; or even sending your Amazon wishlist so we'll know which books to buy you if you win.&lt;/p&gt;

&lt;p&gt;You might be curious about what you need to do to win. Here's an extract from the file &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/RULES&quot;&gt;&lt;code&gt;RULES&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Since &quot;code quality&quot; is a slightly subjective measure, let us provide a few
hints of what we'll be looking for:

* Correctness.
* Readability.
* Consistency.
* Clarity of intent.
* Algorithmic efficiency.
* Idiomatic use of Perl 6.
* Brevity.

In short, what we're looking for is top-quality code. That's how you win.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here are the five tasks. Write Perl 6 programs to...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find a way to express an integer as an expression containing four 9s. (&lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/t1-description&quot;&gt;more&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;List the numbers which are sums of cubes in more ways than one. (&lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/t2-description&quot;&gt;more&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Calculate addition chains. (&lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/t3-description&quot;&gt;more&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Slide a hex-shaped piece across a board. (&lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/t4-description&quot;&gt;more&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;List all possible trees of a certain type. (&lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/t5-description&quot;&gt;more&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We've chosen the problems so that they're easy to explain, but allow contestants
quite a bit of freedom to play around with various solutions.&lt;/p&gt;

&lt;p&gt;If you're curious about the details of the contest, I recommend the file &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/RULES&quot;&gt;&lt;code&gt;RULES&lt;/code&gt;&lt;/a&gt;. For easy downloading, here's &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/contest.zip&quot;&gt;a .zip file&lt;/a&gt; of everything you need for the contest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Addendum:&lt;/strong&gt; For useful afterthoughts, we've decided to keep a file &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/NOTES&quot;&gt;&lt;code&gt;NOTES&lt;/code&gt;&lt;/a&gt; around. Think of it as useful clarifications to the existing files in the repo. We won't pass or fail people based on things found in &lt;code&gt;NOTES&lt;/code&gt;, but the items may help you with the tasks.&lt;/p&gt;

&lt;p&gt;The rest is up to you. Hope hear from you — we &lt;em&gt;want&lt;/em&gt; you to win those books!&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Announce: Perlito version 8; Perl5 and Perl6 compilers by Flavio S. Glock</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2011/12/msg665.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2011/12/msg665.html</id>
		<updated>2011-12-24T11:26:26+00:00</updated>
		<content type="html">Perlito is a compiler collection that contains both a Perl 5 compiler&lt;br /&gt;(perlito5) and a Perl 6 compiler (perlito6).&lt;br /&gt;&lt;br /&gt;The following backends are supported:&lt;br /&gt;&lt;br /&gt;    - Perl5 in Javascript (browser and command-line)&lt;br /&gt;&lt;br /&gt;    - Perl6 in Javascript (browser and command-line)&lt;br /&gt;    - Perl6 in Perl5 (v6.pm, runs in perl 5.8 and up)&lt;br /&gt;    - Perl6 in Python (Python 2.6 and 2.7)&lt;br /&gt;&lt;br /&gt;    There are also many experimental backends.&lt;br /&gt;&lt;br /&gt;Web&lt;br /&gt;&lt;br /&gt;    Run Perlito online, in the browser:&lt;br /&gt;&lt;br /&gt;        http://perlcabal.org/~fglock/perlito5.html&lt;br /&gt;&lt;br /&gt;        http://perlcabal.org/~fglock/perlito6.html&lt;br /&gt;&lt;br /&gt;From CPAN:&lt;br /&gt;&lt;br /&gt;   http://search.cpan.org/dist/v6/lib/v6.pm&lt;br /&gt;&lt;br /&gt;   $ cpan v6&lt;br /&gt;&lt;br /&gt;Perlito is a work in progress. For the source code, to-do list, and bugs:&lt;br /&gt;&lt;br /&gt;    http://github.com/fglock/Perlito&lt;br /&gt;&lt;br /&gt;- Flávio S. Glock (fglock)&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 24 — Subs are Always Better in multi-ples</title>
		<link href="http://perl6advent.wordpress.com/2011/12/24/day-24-subs-are-always-better-in-multi-ples/"/>
		<id>http://perl6advent.wordpress.com/?p=1066</id>
		<updated>2011-12-24T02:15:26+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Hey look, it’s Christmas Eve! (Also, the palindrome of 42!) And today, we’re going to learn about &lt;code&gt;multi&lt;/code&gt; subs, which are essentially synonyms (like any natural language would have). Let’s get started!&lt;/p&gt;
&lt;h2&gt;An Informative Introduction&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;multi&lt;/code&gt; subs are simply subroutines (or anything related to it, such as methods, macros, etc.) that start with the &lt;code&gt;multi&lt;/code&gt; keyword and are then allowed to have the same name as another sub before, provided that sub starts with a &lt;code&gt;multi&lt;/code&gt; (or &lt;code&gt;proto&lt;/code&gt; — that’s later) keyword. What has to be different between these subs is their signature, or list of formal parameters.&lt;/p&gt;
&lt;p&gt;Sound complicated? It isn’t, just take a look at the example below:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;multi sub steve(Str $name) {
    return &quot;Hello, $name&quot;;
}

multi sub steve(Int $number) {
    return &quot;You are person number $number to use this sub!&quot;;
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Every sub was started with the &lt;code&gt;multi&lt;/code&gt; keyword, and has the same name of “steve”, but its parameters are different. That’s how Perl 6 knows which steve to use. If I were to later type &lt;code&gt;steve(&quot;John&quot;)&lt;/code&gt;, then the first steve gets called. If, however, I were to type &lt;code&gt;steve(35)&lt;/code&gt;, then I’d get the second steve sub.&lt;/p&gt;
&lt;h2&gt;Equal Footing with built-ins&lt;/h2&gt;
&lt;p&gt;When you write a &lt;code&gt;multi sub&lt;/code&gt;, and it happens to have the same name as some other built-in, your sub is on equal footing with the compiler’s. There’s no preferring Perl 6′s &lt;code&gt;multi sub&lt;/code&gt; over yours, so if you write a &lt;code&gt;multi sub&lt;/code&gt; with the same name as a built-in and with the same signature, say&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;multi sub slurp($filename) {
    say &quot;Yum! $filename was tasty. Got another one?&quot;;
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And then try calling it with something like &lt;code&gt;slurp(&quot;/etc/passwd&quot;)&lt;/code&gt;, I get this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;Ambiguous dispatch to multi 'slurp'. Ambiguous candidates had signatures:
:(Any $filename)
:(Any $filename)
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Why? Because Perl 6 found two equally valid choices for &lt;code&gt;slurp(&quot;/etc/passwd&quot;)&lt;/code&gt;, my sub and its own, and was unable to decide. That’s the easiest way I know to demonstrate equal footing.&lt;/p&gt;
&lt;h2&gt;A Fun Conclusion&lt;/h2&gt;
&lt;p&gt;Now, since it’s Christmas, let’s try writing another &lt;code&gt;open&lt;/code&gt; sub, but unlike the built-in &lt;code&gt;open&lt;/code&gt; sub, which opens files, this one open presents! Here’s our Present class for this example:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;class Present {
    has $.item;
    has $.iswrapped = True;

    method look() {
        if $.iswrapped {
            say &quot;It's wrapped.&quot;;
        }
        else {
            say $.item;
        }
    }

    method unwrap() {
        $!iswrapped = False;
    }
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now, our open &lt;code&gt;multi sub&lt;/code&gt; looks like this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;multi sub open(Present $present) {
    $present.unwrap;
    say &quot;You unwrap the present and find...!&quot;;
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The signature is vastly different from Perl 6′s own open sub, which is a good thing. And here’s the rest of the code, which makes a Present and uses our new &lt;code&gt;multi sub&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;my $gift = Present.new(:item(&quot;sock&quot;));
$gift.look;
open($gift);
$gift.look;
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;But wait!&lt;/h3&gt;
&lt;p&gt;Running this gets us an error in the latest pull of Rakudo:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;$ ./perl6 present.p6
It's wrapped.
This type cannot unbox to a native string
⋮
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This means that Perl 6′s original open sub is being used, so perhaps it’s being interpreted as an &lt;code&gt;only&lt;/code&gt; sub (&lt;code&gt;only&lt;/code&gt; subs are the default — &lt;code&gt;only sub unique() {...}&lt;/code&gt; and &lt;code&gt;sub unique() {...}&lt;/code&gt; mean the same thing). No matter, let’s try adding a &lt;code&gt;proto sub&lt;/code&gt; line before our multi sub:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;proto sub open(|$) {*}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;A &lt;code&gt;proto sub&lt;/code&gt; allows you to specify the commonalities between multi subs of the same name. In this case, &lt;code&gt;|$&lt;/code&gt; means “every possible argument”, and &lt;code&gt;{*}&lt;/code&gt; means “any kind of code”. It also turns any sub with that name into a &lt;code&gt;multi&lt;/code&gt; sub (unless explicitly defined as something other than &lt;code&gt;multi&lt;/code&gt;). This is useful if you’re, say, importing a &lt;code&gt;&amp;amp;color&lt;/code&gt; sub from a module that isn’t defined as &lt;code&gt;multi&lt;/code&gt; (or explicitly as &lt;code&gt;only&lt;/code&gt;) and you want to have your own &lt;code&gt;&amp;amp;color&lt;/code&gt; sub as well.&lt;/p&gt;
&lt;p&gt;After adding this before our &lt;code&gt;multi sub open&lt;/code&gt;, we get this result:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;$ ./perl6 present.p6
It's wrapped.
You unwrap the present and find...!
sock
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It works! Well, that’s it for &lt;code&gt;multi&lt;/code&gt; subs. For all the nitty-gritty details, see the most current &lt;a href=&quot;http://perlcabal.org/syn/S06.html&quot;&gt;S06&lt;/a&gt;. Enjoy your multi subs and your Christmas Eve!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1066/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/1066/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/1066/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/1066/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/1066/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/1066/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/1066/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/1066/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/1066/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/1066/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/1066/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/1066/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/1066/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/1066/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=1066&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>lueinc</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 23 – Idiomatic Perl 6</title>
		<link href="http://perl6advent.wordpress.com/2011/12/23/day-23-idiomatic-perl-6/"/>
		<id>http://perl6advent.wordpress.com/?p=1049</id>
		<updated>2011-12-23T23:16:52+00:00</updated>
		<content type="html" xml:lang="en">&lt;h2&gt;Perl 6 Idioms, and Idiomatic Perl 6&lt;/h2&gt;
&lt;h4&gt;(Butterflies of the world, alight!)&lt;/h4&gt;
&lt;p&gt;Perl is a richly expressive language, with a warm and playful community. When someone crafts a succinct way to solve a common problem, the Perl community often adopts that solution's phrasing as a idiom. (Other-times, the community recoils in horror and proposes a less obtuse phrasing.)&lt;/p&gt;
&lt;p&gt;Perl 6 adds many elements to the language, and not just keywords; there are metaoperators, clean exceptions, new contexts, better interpolation, frugal OO, and much more. Those additions were shaped by patterns of Perl 5 use (with an eye to future uses), so at least one should scratch some itch you have long ignored. The new bits aren't required, but we like the shiny, so be prepared for a slew of new idioms soon after &lt;a class=&quot;podlinkurl&quot; href=&quot;http://www.perlfoundation.org/perl6/index.cgi?faq#when_will_perl_6_be_released&quot;&gt;Christmas&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Most Perl 6 idioms will not just be translated versions of familiar Perl 5 idioms; they will use new features where appropriate, and may seem unfamiliar at first. If you regularly use any of the Perl 5 idioms below, you can expect to grok its new form soon after you embrace Perl 6 itself.&lt;/p&gt;
&lt;p&gt;Idiomatic Perl 6 should feel just as Perlish as Perl 5, once you get used to it. After all, it is all &lt;b&gt;Perl&lt;/b&gt;.&lt;/p&gt;
&lt;h2&gt;Conventions&lt;/h2&gt;
&lt;h4&gt;(Details, details)&lt;/h4&gt;
&lt;p&gt;Definitions (corrupted^W adapted for computer languages):&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;Idiom&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;A phrase &lt;b&gt;expected&lt;/b&gt; to be used to express an idea.&lt;/p&gt;
&lt;/dd&gt;&lt;dt&gt;Idiomatic&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;Expressed as the language's &lt;b&gt;native&lt;/b&gt; users would state it.&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;In most examples below, the code is shown in four versions:&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;1. Non-idiomatic Perl 5,&lt;/dt&gt;
&lt;dd&gt;
&lt;/dd&gt;&lt;dt&gt;2. then made idiomatic.&lt;/dt&gt;
&lt;dd&gt;
&lt;/dd&gt;&lt;dt&gt;#&lt;/dt&gt;
&lt;dd&gt;
&lt;/dd&gt;&lt;dt&gt;3. Perl 5 idiom, naively translated into Perl 6,&lt;/dt&gt;
&lt;dd&gt;
&lt;/dd&gt;&lt;dt&gt;4. then made idiomatic.&lt;/dt&gt;
&lt;/dl&gt;
&lt;p&gt;Any versions past #4 are to show &lt;a class=&quot;podlinkurl&quot; href=&quot;http://catb.org/jargon/html/T/TMTOWTDI.html&quot;&gt;TMTOWTDI&lt;/a&gt;. Notice how the code gets clearer or more concise as it goes from 1 to 4.&lt;/p&gt;
&lt;h2&gt;Idiom ==&amp;gt; Word&lt;/h2&gt;
&lt;h4&gt;(Movin' on up)&lt;/h4&gt;
&lt;p&gt;Some Perl 5 idioms were so useful and conceptually concise, that they became Perl 6 &quot;words&quot; in their own right. These words take the form of new built-in operators, functions, and methods.&lt;/p&gt;
&lt;pre&gt; # Pick a random array element
 $z = $array[ int(rand scalar(@array)) ];
 $z = $array[ rand @array ];
 #
 $z = @array[ rand*@array ];
 $z = @array.pick;            

 # Loop over the keys (indexes) of an array
 for ( my $i=0; $i&amp;lt;@array; $i++ ) {...}
 for my $i ( 0 .. $#array ) {...}
 #
 for 0 .. @array.end -&amp;gt; $i {...}
 for @array.keys -&amp;gt; $i {...}

 # Whole number division
 ( ($x - ($x % 3) ) / 3 )
 int( $x / 3 )
 #
 Int( $x / 3 )
 $x div 3                  # Integer division op

 # Print the count of the elements of an array.
 say scalar @array;
 say 0+@array;
 #
 say 0+@array;      # Identical in Perl 6
 say +@array;       # + forces the new &quot;numeric&quot; context
 say @array.elems;  # .elems method is more explicit.

 # Do something every 5th time
 if ( ($x/5) == int($x/5) ) {...}
 if ( !($x % 5) ) {...}
 #
 if !($x % 5) {...}
 if $x %% 5 {...}           # %% means &quot;is evenly divisible by&quot;

 # Do something $n times, counting up to $n-1
 for ( $_=0; $_ &amp;lt; $n; $_++ ) {...}
 for ( 0 .. ($n-1) ) {...}
 #
 for 0 ..^ $n {...}
 for ^$n {...}                      # ^9 means 0 ..^ 9, or 0..8&lt;/pre&gt;
&lt;p&gt;Bare method calls are *always* methods on &lt;code&gt;$_&lt;/code&gt;, eliminating Perl 5's confusion on which functions default to &lt;code&gt;$_&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Other defaults have been tweaked to move from something-else-I-must-remember to obvious.&lt;/p&gt;
&lt;pre&gt; # Split on whitespace
 @words = split /\s+/, $_;
 @words = split;          # Default is useful, but not intuitive
 #
 @words = .split(/\s+/);  # split() now has no default pattern
 @words = .words;         # split's old default behavior is now a separate method: .words

 # Split a string into individual characters.
 @chars = map { substr $word, $_, 1 } 0..length($word);
 @chars = split '', $word; # Split on nothingness
 #
 @chars = $word.split('');
 @chars = $word.comb;      # Default is to &quot;keep everything&quot;

 # Infinite loop
 for (;;) {...}    # Spoken with a 'C' accent
 while (1) {...}
 #
 while 1 {...}
 loop {...}        # No limit given, so endless by default&lt;/pre&gt;
&lt;p&gt;Some idioms that became words were already words in Perl 5, if you used the appropriate module.&lt;/p&gt;
&lt;pre&gt; # Return the unique elements from a list, in original order
 my %s, @r; for @a { push @r, $_ if !$s{$_}; $s{$_}++; } return @r;
 my %s; return grep { !$s{$_}++ } @a;    # or List::MoreUtils::uniq
 #
 my %s; return grep { !%s{$_}++ }, @a;
 return @a.uniq;

 # Add up all list elements
 my $sum = 0; for my $num (@a) { $sum += $num }
 my $sum; $sum += $_ for @a;    # or List::Util::sum
 #
 my $sum = @a.reduce(*+*);
 my $sum = [+] @a;              # [op] applies op to entire list&lt;/pre&gt;
&lt;h2&gt;Idiom ==&amp;gt; Idiom&lt;/h2&gt;
&lt;h4&gt;(The song remains the same)&lt;/h4&gt;
&lt;p&gt;Some idioms remain the same, modulo required syntax changes.&lt;/p&gt;
&lt;pre&gt; @alpha = 'A' .. 'Z';

 @a = qw{ able baker charlie };

 %meta = ( foo =&amp;gt; 'bar', baz =&amp;gt; 'quz' );

 @squares = map { $_ * $_ }, @a;

 @starts_with_number = grep { /^\d/ }, @a;&lt;/pre&gt;
&lt;p&gt;Didn't those all look familiar? Sure, parenthesis are no longer needed on list assignment, and qw{} now has a an angle-bracket shortcut, but those are optional, and don't really change the gist of the idioms. Add that comma after the map|grep block, and these Perl 5 idioms still stand strong in Perl 6.&lt;/p&gt;
&lt;p&gt;Perl 5's &quot;magic diamond&quot; idiom still exists, just spelled more sanely (and less diamond-ly).&lt;/p&gt;
&lt;pre&gt; # Process each line from STDIN or from command-line files.
 for my $file (@ARGV) { open FH, $file; while (&amp;lt;FH&amp;gt;) {...} }
 while (&amp;lt;&amp;gt;) {...}               # Null filehandle is magical
 #
 for $*ARGFILES.lines {...}
 for lines() {...}              # lines() defaults to $fh = $*ARGFILES&lt;/pre&gt;
&lt;h2&gt;Idiom 5 ==&amp;gt; Idiom 6&lt;/h2&gt;
&lt;h4&gt;(The more things change, the more they remain the same)&lt;/h4&gt;
&lt;p&gt;Some idioms have taken new form, when the idea behind the original idiom found better expression through new language elements.&lt;/p&gt;
&lt;pre&gt; # Hash initialization to constant
 my %h;   for (@a) { $h{$_} = 1 }
 my %h = map { $_ =&amp;gt; 1 } @a;
 #
 my %h = map { $_ =&amp;gt; 1 }, @a;
 my %h = @a X=&amp;gt; 1;

 # Hash initialization for enumeration
 my %h;   for (0..$#a) { $h{ $a[$_] } = $_ }
 my $c;   my %h = map { $_ =&amp;gt; ++$c } @a;
 #
 my $c;   my %h = map { $_ =&amp;gt; ++$c }, @a;
 my %h = @a Z=&amp;gt; 1..*;
 my %h = @a.pairs».invert;  # if zero based

 # Hash initialization from parallel arrays
 my %h;   for (@a) { $h{$_} = shift @b }
 my %h;   @h{@a} = @b;
 #
 my %h;   %h{@a} = @b;
 my %h = @a Z=&amp;gt; @b;

 # Swap two variables
 my $temp = $x; $x = $y; $y = $temp;
 ( $x, $y ) = ( $y, $x );
 #
 ( $x, $y ) =   $y, $x;
 ( $x, $y ) .= reverse;   # .= makes reverse into a &quot;mutating&quot; method
 # Tastes great on array swaps, too!   @a[ $j, $k ] .= reverse;

 # Rotate array left by 1 element
 my $temp = shift @a; push @a, $temp;
 push @a, shift @a;
 #
 @a.push: @a.shift;
 @a .= rotate;

 # Create an object
 my $pet = new Dog;
 my $pet = Dog-&amp;gt;new;
 #
 my $pet = Dog.new;
 my Dog $pet .= new;    # $pet *always* isa Dog; Compiler can optimize!&lt;/pre&gt;
&lt;p&gt;Combining transformation with selection was an advanced idiom in Perl 5. The new return values for &lt;code&gt;if&lt;/code&gt; provide a bite-sized idiom.&lt;/p&gt;
&lt;pre&gt; # Three copies of elements &amp;gt; 5
 @z = map { ($_) x 3 } grep { $_ &amp;gt; 5 } @y;    # map,grep
 @z = map { $_ &amp;gt; 5 ? ($_) x 3 : () } @y;      # map as grep
 #
 @z = map { $_ &amp;gt; 5 ?? ($_) xx 3 !! Nil }, @y;
 @z = @y.map: { $_ xx 3 if $_ &amp;gt; 5 };          # !if == Empty list
 @z = ($_ xx 3 if $_ &amp;gt; 5 for @y);             # List comprehension&lt;/pre&gt;
&lt;p&gt;That fifth form is a &lt;a class=&quot;podlinkurl&quot; href=&quot;http://en.wikipedia.org/wiki/List_comprehension&quot;&gt;list comprehension&lt;/a&gt;, popular in functional languages, and in our &lt;a class=&quot;podlinkurl&quot; href=&quot;http://rosettacode.org/wiki/List_comprehensions#Python&quot;&gt;closer cousin&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Sentence|Paragraph ==&amp;gt; Idiom&lt;/h2&gt;
&lt;h4&gt;(The territory becomes the map)&lt;/h4&gt;
&lt;p&gt;Some larger code blocks can now be expressed so concisely that they become idioms in their own right.&lt;/p&gt;
&lt;pre&gt; # Random integer between 3 and 7 inclusive
 do { $z = int rand 8 } until $z &amp;gt;= 3;
 $z = 3 + int rand 5;
 #
 $z = 3 + Int(5.rand);
 $z = (3..7).pick;

 # Count by 3 in an infinite loop
 for ( my $i = 1; ; $i++ ) { my $n = 3 * $i; ... }
 for ( my $n = 3; ; $n += 3 ) {...}
 #
 loop ( my $n = 3; ; $n += 3 ) {...}
 for 3, * + 3 ... * -&amp;gt; $n {...}      # `...` is the &quot;sequence&quot; operator
 for 3, 6, 9 ... * -&amp;gt; $n {...}       # `...` can infer from example list

 # Loop over a range, excluding the start and end points
 for my $i ( $start .. $limit ) { next if $i == $start or $i == $limit; ... }
 for my $i ( ($start+1) .. ($limit-1) ) {...}
 #
 for ($start+1) .. ($limit-1) -&amp;gt; $i {...}
 for $start ^..^ $limit -&amp;gt; $i {...}&lt;/pre&gt;
&lt;h2&gt;Predictions&lt;/h2&gt;
&lt;h4&gt;(Gaze into my crystal ball)&lt;/h4&gt;
&lt;p&gt;The idioms above are not written in stone. After &lt;a class=&quot;podlinkurl&quot; href=&quot;http://www.perlfoundation.org/perl6/index.cgi?faq#when_will_perl_6_be_released&quot;&gt;Christmas&lt;/a&gt;, they may be given the boot, eighty-sixed, or traded-in for a newer model. Furthermore, other forces are at work to season this stew. Please indulge these prognostications:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We will see more use of exceptions. They are now cleaner and cheaper and don't need eval(), and users will be introduced to them much sooner due to open()'s new exception-based error handling.&lt;/li&gt;
&lt;li&gt;We will see more hash|array slicing. Beginners had to grok another sigil rule to use slices, now they don't! In fact, single-element access now just looks like a degenerate case of multiple-element access.&lt;/li&gt;
&lt;li&gt;Lazy lists are cool and efficient. Coding practices will be shaped to allow lists to stay lazy longer.&lt;/li&gt;
&lt;li&gt;The new hyper-operators are implicitly parallel. We will see less explicit threading, and more set-at-a-time thinking.&lt;/li&gt;
&lt;li&gt;In Perl 5, OO (before Moose) was overly wordy to the point of being grating. Functional programming worked best using the `&amp;amp;` prototype, but we are all told to never use Perl 5's prototypes!
&lt;p&gt;In Perl 6, OO and functional styles are so low-friction that you will hoist code across paradigm boundaries with the same ease that you refactor same-paradigm code today.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;`say` will rule the world, with legions of inlined ».methods as its army.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;OK, maybe not that last one :)&lt;/p&gt;
&lt;p&gt;The crystal ball may be hazy, but the future looks bright!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1049/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/1049/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/1049/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/1049/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/1049/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/1049/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/1049/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/1049/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/1049/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/1049/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/1049/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/1049/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/1049/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/1049/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=1049&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>utilpm</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 22 – Operator overloading, revisited</title>
		<link href="http://perl6advent.wordpress.com/2011/12/22/day-22-operator-overloading-revisited/"/>
		<id>http://perl6advent.wordpress.com/?p=1044</id>
		<updated>2011-12-22T20:58:11+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Today’s post is a follow-up. Exactly two years ago, Matthew Walton wrote on this blog about &lt;a href=&quot;http://perl6advent.wordpress.com/2009/12/22/day-22-operator-overloading/&quot; title=&quot;Day 22, 2009: operator overloading&quot;&gt;overloading operators&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;You can exercise further control over the operator’s parsing by adding traits to the definition, such as &lt;code&gt;tighter&lt;/code&gt;, &lt;code&gt;equiv&lt;/code&gt; and &lt;code&gt;looser&lt;/code&gt;, which let you specify the operator’s precedence in relationship to operators which have already been defined. Unfortunately, at the time of writing this is not supported in Rakudo so we will not consider it further today.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Rakudo is still lagging in precedence support (though at this point there are no blockers that I know about to simply going ahead and implementing it). But there’s a new implementation on the block, one that didn’t exist two years ago: Niecza.&lt;/p&gt;
&lt;p&gt;Let’s try out operator precedence in Niecza.&lt;/p&gt;
&lt;pre&gt;$ niecza -e 'sub infix:&amp;lt;mean&amp;gt;($a, $b) { ($a + $b) / 2 }; say 10 mean 4 * 5'
15&lt;/pre&gt;
&lt;p&gt;Per default, an operator gets the same precedence as &lt;code&gt;infix&amp;lt;+&amp;gt;&lt;/code&gt;. This is per spec. (How do we know it got the same precedence as &lt;code&gt;infix&amp;lt;+&amp;gt;&lt;/code&gt; above? Well, we know it’s not tighter than multiplication, otherwise we’d have gotten the result 35.)&lt;/p&gt;
&lt;p&gt;That’s all well and good, but what if we want to make our mean little operator evaluate tighter than multiplication? Nothing could be simpler:&lt;/p&gt;
&lt;pre&gt;$ niecza -e 'sub infix:&amp;lt;mean&amp;gt;($a, $b) is tighter(&amp;amp;infix:&amp;lt;*&amp;gt;) { ($a + $b) / 2 }; say 10 mean 4 * 5'
35&lt;/pre&gt;
&lt;p&gt;See what we did there? &lt;code&gt;is tighter&lt;/code&gt; is a &lt;em&gt;trait&lt;/em&gt; that we apply to the operator definition. The trait accepts an argument, in this case the language-provided multiplication operator. It all reads quite well, too: “infix mean is tighter [than] infix multiplication”.&lt;/p&gt;
&lt;p&gt;Note the explicit use of intuitive naming for the precedence levels. Rather than the inherently confusing terms “higher/lower”, Perl 6 talks about “tighter/looser”, as in “multiplication binds tighter than addition”. Easier to think about precedence that way.&lt;/p&gt;
&lt;p&gt;Internally, the precedence levels are stored not as numbers but as strings. Each original precedence level gets a letter of the alphabet and an equals sign (&lt;code&gt;=&lt;/code&gt;). Subsequent added precendence levels append either a less-than sign (&lt;code&gt;&amp;lt;&lt;/code&gt;) or a greater-than sign (&lt;code&gt;&amp;gt;&lt;/code&gt;) to an existing precedence level representation. Using this system, we never “run out” of levels between existing ones (as we could if we were using integers, for example), and tighter levels always come lexigographically before looser ones. Language designers, take heed.&lt;/p&gt;
&lt;p&gt;A few last passing notes about operators in Perl 6, while we’re on the subject:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Perl 6, &lt;strong&gt;operators are subroutines&lt;/strong&gt;. They just happen to have funny names, like prefix:&amp;lt;-&amp;gt; or postfix:&amp;lt;++&amp;gt; or infix:&amp;lt;?? !!&amp;gt;. This actually takes a lot of the hand-wavey magic out of defining them. The traits that we’ve seen applied to operators are really subroutine traits… these just happen to be relevant to operator definitions.&lt;/li&gt;
&lt;li&gt;As a consequence, just like subroutines, &lt;strong&gt;operators are lexically scoped&lt;/strong&gt; by default. Lexical scoping is something we like in Perl 6; it keeps popping up in unexpected places as a solid, sound design principle in the language. In practice, this means that if you declare an operator within a given scope, the operator will be visible and usable within that scope. You’re modifying the parser, but you’re doing it locally, within some block or other. (Or within the whole file, of course.)&lt;/li&gt;
&lt;li&gt;Likewise, if you want to &lt;strong&gt;export your operators&lt;/strong&gt;, you just use the same exporting mechanism used with subroutines. See how this unification between operators and subroutines keeps making sense? (In Perl 6-land, we say “operators are just funny-looking subroutines”.)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multiple dispatch in operators&lt;/strong&gt; works just as with ordinary subroutines. Great if you want to dispatch your operators on different types. As with all other routines in the core library in Perl 6, all operators are declared multi to be able to co-exist peacefully with module extensions to the language.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Operators can be macros&lt;/strong&gt;, too. This is not an exceptions to the rule that operators are subroutines, because in Perl 6, macros are subroutines. In other words, if you want some syntactic sugar to execute at parse time (which is what a macro does), you can dress it up either as a normal-looking sub, or as an operator.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That’s it for today. Now, go forth and multiply, or even define your own operator that’s either tighter or looser than multiplication.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1044/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/1044/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/1044/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/1044/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/1044/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/1044/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/1044/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/1044/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/1044/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/1044/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/1044/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/1044/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/1044/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/1044/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=1044&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>carl</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Native libraries, native objects</title>
		<link href="http://perl6advent.wordpress.com/2011/12/21/native-libraries-native-objects/"/>
		<id>http://perl6advent.wordpress.com/?p=1037</id>
		<updated>2011-12-21T21:42:29+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Last year flussence++ wrote a nice post about writing XMMS bindings for Perl 6 using the Native Call Interface. It has improved a bit since then, (at least NCI, I don’t know about XMMS), so let’s show it off a bit.&lt;/p&gt;
&lt;p&gt;To run the examples below you need a &lt;a href=&quot;https://github.com/jnthn/zavolaj/&quot;&gt;NativeCall&lt;/a&gt; module installed. Then add &lt;code&gt;use NativeCall;&lt;/code&gt; at the top of the file.&lt;/p&gt;
&lt;p&gt;Previously, we were carefully writing all the C subs we needed to use and then usually writing some Perl 6 class which wrapped it in a nice, familiar interface. That doesn’t change much, except that now a class is not really an interface for some C-level data structure. Thanks to the new metamodel we can now make our class to actually &lt;em&gt;be&lt;/em&gt; a C-level data structure, at least under the hood. Consider a class representing a connection to Music Player Daemon:&lt;/p&gt;
&lt;pre&gt;    class Connection is repr('CPointer') {
        sub mpd_connection_new(Str $host, Int $port)
            returns Connection
            is native('libmpdclient.so') {}
        sub mpd_connection_free()
            is native('libmpdclient.so') {}
        method new(Str $host, Int $port) {
            self.bless(mpd_connection_new($host, $port))
        }
        method DESTROY {
            mpd_connection_free(self)
        }
    }&lt;/pre&gt;
&lt;p&gt;The first line does not necesarilly look familiar. The &lt;code&gt;is repr&lt;/code&gt; trait tells the compiler that the internal representation of the class &lt;code&gt;Connection&lt;/code&gt; is a C pointer. It still is a fully functional Perl 6 type, which we can use in method signatures or wherever (as seen in the lines below).&lt;/p&gt;
&lt;p&gt;We then declare some native fuctions we’re going to use. It’s quite convenient to put them inside the class body, so they don’t pollute the namespace and don’t confuse the user. What we are really exposing here is the &lt;code&gt;new&lt;/code&gt; method, which uses &lt;code&gt;bless&lt;/code&gt; to set the object’s internal representation to what &lt;code&gt;mpd_connection_new&lt;/code&gt; has returned. From now on our object is a Perl 6 level object, while under the hood being a mere C pointer. In method &lt;code&gt;DESTROY&lt;/code&gt; we just pass &lt;code&gt;self&lt;/code&gt; to another native function, &lt;code&gt;mpd_connection_free&lt;/code&gt;, without the need to unbox it or whatever. The &lt;code&gt;NativeCall&lt;/code&gt; module will just extract its internal representation and pass it around. Ain’t that neat?&lt;/p&gt;
&lt;p&gt;Let’s see some bigger example. We’ll use &lt;code&gt;taglib&lt;/code&gt; library to extract the metadata about some music files lying around. Let’s see the &lt;code&gt;Tag &lt;/code&gt;class first:&lt;/p&gt;
&lt;pre&gt;    class Tag is repr('CPointer') {
        sub taglib_tag_title(Tag)  returns Str is native('libtag_c.so') {}
        sub taglib_tag_artist(Tag) returns Str is native('libtag_c.so') {}
        sub taglib_tag_album(Tag)  returns Str is native('libtag_c.so') {}
        sub taglib_tag_genre(Tag)  returns Str is native('libtag_c.so') {}
        sub taglib_tag_year(Tag)   returns Int is native('libtag_c.so') {}
        sub taglib_tag_track(Tag)  returns Int is native('libtag_c.so') {}
        sub taglib_tag_free_strings(Tag)       is native('libtag_c.so') {}

        method title  { taglib_tag_title(self)  }
        method artist { taglib_tag_artist(self) }
        method album  { taglib_tag_album(self)  }
        method genre  { taglib_tag_genre(self)  }
        method year   { taglib_tag_year(self)   }
        method track  { taglib_tag_track(self)  }

        method free   { taglib_tag_free_strings(self) }
    }&lt;/pre&gt;
&lt;p&gt;That one is pretty boring: plenty of native functions, and plenty of methods being exactly the same things. You may have noticed the lack of &lt;code&gt;new&lt;/code&gt;: how are we going to get an object and read our precious tags? In &lt;code&gt;taglib&lt;/code&gt;, the actual &lt;code&gt;Tag&lt;/code&gt; object is obtained from a &lt;code&gt;Tag_File &lt;/code&gt;object first. Why didn’t we implement it first? Well, it’s going to have a method returning the &lt;code&gt;Tag&lt;/code&gt; object shown above, so it was convenient to declare it first.&lt;/p&gt;
&lt;pre&gt;    class TagFile is repr('CPointer') {
        sub taglib_file_new(Str) returns TagFile is native('libtag_c.so') {}
        sub taglib_file_free(TagFile)            is native('libtag_c.so') {}
        sub taglib_file_tag(TagFile) returns Tag is native('libtag_c.so') {}
        sub taglib_file_is_valid(TagFile) returns Int
            is native('libtag_c.so') {}

        method new(Str $filename) {
            unless $filename.IO.e {
                die &quot;File '$filename' not found&quot;
            }
            my $self = self.bless(taglib_file_new($filename));
            unless taglib_file_is_valid($self) {
                taglib_file_free(self);
                die &quot;'$filename' is invalid&quot;
            }
            return $self;
        }

        method tag  { taglib_file_tag(self)  }

        method free { taglib_file_free(self) }
    }&lt;/pre&gt;
&lt;p&gt;Note how we use native functions in &lt;code&gt;new&lt;/code&gt; to check for exceptional situations and react in an appropriately Perl 6 way. Now we only have to write a simple MAIN before we can test it on our favourite music files.&lt;/p&gt;
&lt;pre&gt;    sub MAIN($filename) {
        my $file = TagFile.new($filename);
        my $tag  = $file.tag;
        say 'Artist: ', $tag.artist;
        say 'Title:  ', $tag.title;
        say 'Album:  ', $tag.album;
        say 'Year:   ', $tag.year;

        $tag.free;
        $file.free;
    }&lt;/pre&gt;
&lt;p&gt;Live demo! Everyone loves live demos.&lt;/p&gt;
&lt;pre&gt;    $ perl6 taginfo.pl some-track.mp3
    Artist: Diablo Swing Orchestra
    Title:  Balrog Boogie
    Album:  The Butcher's Ballroom
    Year:   2009&lt;/pre&gt;
&lt;p&gt;Works like a charm. I promise I’ll wrap it up in some nice &lt;code&gt;Audio::Tag &lt;/code&gt;module and release it on Github shortly.&lt;/p&gt;
&lt;p&gt;Of course there’s more to do with NativeCall than just passing raw pointers around. You could, for example, declare it as a &lt;code&gt;repr('CStruct')&lt;/code&gt; and access the &lt;code&gt;struct&lt;/code&gt; field directly, as you would in good, old C. This is only partly implemented as for now though, but that shouldn’t stop you from experimenting and seeing what you can do before Christmas. Happy hacking!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1037/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/1037/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/1037/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/1037/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/1037/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/1037/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/1037/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/1037/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/1037/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/1037/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/1037/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/1037/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/1037/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/1037/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=1037&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>ttjjss</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Paired up Hashes</title>
		<link href="http://perl6advent.wordpress.com/2011/12/20/paired-up-hashes/"/>
		<id>http://perl6advent.wordpress.com/?p=989</id>
		<updated>2011-12-20T14:31:49+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;What is is possible with arrays and lists in Perl 6 is truly remarkable and was demonstrated here several times. But what about hashes?&lt;br /&gt;
Superficially not much has changed.&lt;br /&gt;
(Following Damian’s rule from PBP to name a hash variable in singular.)&lt;/p&gt;
&lt;pre&gt;    %song = Panacea =&amp;gt; 'found a lover', Photek =&amp;gt; 'ni ten ichi ryu';
    say keys %song;   # also %song.keys
    say values %song; # %song.values&lt;/pre&gt;
&lt;p&gt;Yes, the sigils are now invariant, so you get values with:&lt;/p&gt;
&lt;pre&gt;    %song{'Panacea'}
    %song{'Panacea', 'Photek'}&lt;/pre&gt;
&lt;p&gt;That can be shortened, because &amp;lt;&amp;gt; is the new qw():&lt;/p&gt;
&lt;pre&gt;    %song&amp;lt;Panacea&amp;gt;
    %song&amp;lt;Panacea Photek&amp;gt;&lt;/pre&gt;
&lt;p&gt;Frankly, almost everything else has changed. Perl 6 can be sometimes hideous, just mimicking to be your good old pal Perl 5 while being a friendly T-X, blasting behind your back your programming problems away. The fat arrow is no longer a fancy comma but an infix operator, creating an object that contains a key-value pair.&lt;/p&gt;
&lt;pre&gt;    my $song = paniq =&amp;gt; 'Godshatter';
    say $song.WHAT; # says: &quot;Pair()&quot;
    $song.key;     # as expected is paniq
    $song.value;  # you guess it&lt;/pre&gt;
&lt;p&gt;There is another Syntax for that, heavily used in signatures:&lt;/p&gt;
&lt;pre&gt;    my $song = :paniq('Godshatter');&lt;/pre&gt;
&lt;p&gt;But what happens if I:&lt;/p&gt;
&lt;pre&gt;    my @songs = %song; # same as @(%songs)&lt;/pre&gt;
&lt;p&gt;You maybe predicted it, @songs gets a list of pairs. For the old behaviour, you have to say explicitly: “I want the keys and values as a list.”:&lt;/p&gt;
&lt;pre&gt;    my @songs = %song.kv; # key 1, value 1, key 2 ....&lt;/pre&gt;
&lt;p&gt;This new setup of hashes is not only theoretically very pleasing. It also allows iterating over hashes, without the risk of loosing the precious key =&amp;gt; value correlation. That’s handy for all kinds of sorting and mashing of data, for which Perl is famous. What else did Randal L. Schwartz once upon a time than creating a list of pairs, sorting them and then picking the needed data bits.&lt;/p&gt;
&lt;p&gt;Having pairs as a built-in type helps also subs and methods to handle their parameters. Some of the can be positional, which could be ordered in an array. Some of them are named and could be stored in a hash. But they are actually stored in a “Parcel”, a list that can contain pairs. This way the order of the parameters and the key =&amp;gt; value correlations are preserved.&lt;/p&gt;
&lt;p&gt;A very similar type is the Capture, which can hold all parameter sent to a routine. Therefore it has to behave more like routine and pass all the named arguments under their names. But if you ask for the positional parameter, you get only them, not the named ones. With a Capture full of values you can ask with a smartmatch if it would pass a certain subroutine and many fine things more. The vaults are going here deeper and deeper, but lets get back to the daylight of everyday hash-usage.&lt;/p&gt;
&lt;p&gt;Panacea aka Mathis Mootz had a lot of great tracks. But when I do:&lt;/p&gt;
&lt;pre&gt;    %song&amp;lt;Panacea&amp;gt; = &quot;state of extacy&quot;;&lt;/pre&gt;
&lt;p&gt;“found a lover” gets overwritten. Nothing new so far, but there are times I just don’t want to loose my data. Then I need to execute some force onto the hash.&lt;/p&gt;
&lt;pre&gt;    %song.push( Panacea =&amp;gt; &quot;state of extacy&quot; );&lt;/pre&gt;
&lt;p&gt;Whole lists of pairs can be pushed into another hash this way. The result will be (not surprisingly) still a hash but the key ‘Panacea’ now points to an array, containing both song titles. That’s also useful when inverting a hash, that means pulling out a pair-list where key and value are flipped. Pasting that into a hash may lead to collisions, if several keys have the same value. A simple:&lt;/p&gt;
&lt;pre&gt;    # list with song =&amp;gt; artist pairs
    %song = %artist.invert;&lt;/pre&gt;
&lt;p&gt;might produce losses, but the following does not:&lt;/p&gt;
&lt;pre&gt;    %song.push( %artist.invert ); # or:
    %song.push: %artist.invert;&lt;/pre&gt;
&lt;p&gt;While doing some heavy data munging you might regroup the values under a different set of keys. In that case it is likely that several values will end up under the same key. Given you have a sub that recognizes a genre of a song, you might write something like:&lt;/p&gt;
&lt;pre&gt;    map { %genre.push(genre_of_song($_) =&amp;gt; $_) }, %song.values;&lt;/pre&gt;
&lt;p&gt;But as you already guessed it, there is an easier way to do that:&lt;/p&gt;
&lt;pre&gt;    %genre = classify { (genre_of_song($_) }, %song.values;&lt;/pre&gt;
&lt;p&gt;Now you probably say: “That’s unrealistic!”. There are songs for instance from “Magnetic Man” that can be labeled “Drum ‘n Base”, “Dubstep” or even “Pop”. Larry knows that. (This kind of problem of course.) That’s why he pulled out a second hash generating method.&lt;/p&gt;
&lt;pre&gt;    %genre = categorize { (genre_of_song($_) }, %song.values;&lt;/pre&gt;
&lt;p&gt;Unlike classify, which expects exactly one value (Called scalar in P5 but item in Perl 6 world), categorize can handle a list of results returned by the closure (block). It also happily accepts a Nil, which means, unlike undef in Perl 5, really nothing. When classify gets a Nil, the song will then not appear in any category, meaning under no hash key.&lt;/p&gt;
&lt;p&gt;Imagine a routine of real artificial intelligence that can distinct good from bad songs. (Your definition of good of course!)&lt;/p&gt;
&lt;pre&gt;    my %quality = classify { good_music($_) ?? 'good' !! 'bad' }, %song.values;&lt;/pre&gt;
&lt;p&gt;Hence %quality&amp;lt;good&amp;gt; contains all the songs I sent to my music player and %quality&amp;lt;bad&amp;gt; to /dev/null (which is the name of another electronic music artist).&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/989/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/989/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/989/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/989/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/989/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/989/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/989/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/989/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/989/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/989/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/989/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/989/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/989/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/989/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=989&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>sirlichtkind</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 19 – Abstraction and why it’s good</title>
		<link href="http://perl6advent.wordpress.com/2011/12/19/day-19-abstraction-and-why-its-good/"/>
		<id>http://perl6advent.wordpress.com/?p=1010</id>
		<updated>2011-12-19T21:30:09+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Some people are a bit afraid of the word “abstract”, because they’ve heard math teachers say it, and also, abstract art freaks them out. But abstraction is a fine and useful thing, and not so complicated. As programmers, we use it every day in different forms. The term is from Latin and means “to withdraw from” or “to pull away from”, and what we’re pulling away from is the specifics so we can focus on the big picture. That’s often mighty useful.&lt;/p&gt;
&lt;p&gt;Here are a few examples:&lt;/p&gt;
&lt;h2&gt;Variables&lt;/h2&gt;
&lt;p&gt;If your computer only knew how to handle one specific number at a time, it’d be an abacus. Pretty early on, the programmer guild figured out it made a lot of sense to talk about the memory address of a value, and let that address contain whatever it pleased. They abstracted away from the value, and thus made the program more general.&lt;/p&gt;
&lt;p&gt;As time passed, addresses were replaced by names, mostly as a convenience. Some people found it a good idea to give their variables descriptive names, as opposed to things like &lt;code&gt;$grbldf&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Subroutines&lt;/h2&gt;
&lt;p&gt;Code re-use. We hear so much about it in the OO circles, but it holds equally well for subroutines. You write your code once, and then call it from all over the place. Convenient.&lt;/p&gt;
&lt;p&gt;But, as I point out in &lt;a href=&quot;http://strangelyconsistent.org/blog/yapsi-201103-released&quot;&gt;an announcement pretending to be a computer science professor from an alternate timeline&lt;/a&gt;, there’s also the secondary benefit of giving your chunk of code a good mnemonic name, because that act in a sense improves the programming language itself. You’re giving yourself new verbs to program with.&lt;/p&gt;
&lt;p&gt;This is especially true in Perl 6, because subroutines are lexically scoped (as opposed to Perl 5) and thus you can easily put a subroutine inside another routine. I use it when writing &lt;a href=&quot;http://strangelyconsistent.org/blog/june-25-2011-connect-4&quot;&gt;a Connect 4 game&lt;/a&gt;, for example.&lt;/p&gt;
&lt;h2&gt;Packages and modules&lt;/h2&gt;
&lt;p&gt;In Perl, packages don’t do much. They pull things together and keep them there. In a sense, what they abstract away is a set of subroutines from the rest of the world.&lt;/p&gt;
&lt;p&gt;Perl 5 delivers its whole OO functionality through packages and a bit of dispatch magic on the side. It’s quite a feat, actually, but sometimes a bit &lt;em&gt;too&lt;/em&gt; minimal. Moose fixes many of those early issues by providing a full-featured object system. Perl 6 lets packages go back to just being collections of subroutines, but provides a few dedicated abstractions for OO, a kind of built-in Moose. Which brings us to…&lt;/p&gt;
&lt;h2&gt;Classes&lt;/h2&gt;
&lt;p&gt;Object-orientation means a lot of different things to different people. To some, it’s the notion of an &lt;em&gt;object&lt;/em&gt;, a piece of memory with a given set of operations and a given set of states. In a sense, we’re again in the business of extending the language like with did with subroutines. But this time we’re building new &lt;em&gt;nouns&lt;/em&gt; rather than new verbs. One moment the language doesn’t know about a &lt;code&gt;Customer&lt;/code&gt; object type; the next, it does.&lt;/p&gt;
&lt;p&gt;To others, object-orientation means keeping the operations public and the states private. They refer to this division as &lt;em&gt;encapsulation&lt;/em&gt;, because the object is like a little capsule, protecting your data from the big bad world. This is also a kind of abstraction, built on the idea that the rest of the world shouldn’t &lt;em&gt;need&lt;/em&gt; to care about the internals of your objects, because some day you may want to refactor them. Don’t talk to the brain, talk to the hand; do your thing through the published operations of the object.&lt;/p&gt;
&lt;h2&gt;Roles&lt;/h2&gt;
&lt;p&gt;But class-based OO with inheritance will take you only so far. In the past 10 years or so, people have become increasingly aware of the limitations of inheritance-based class hierarchies. Often there are concerns which cut completely across a conventional inheritance hierarchy.&lt;/p&gt;
&lt;p&gt;This is where &lt;em&gt;roles&lt;/em&gt; come in; they allow you to apply behaviors in little cute packages here and there, without being tied up by a tree-like structure. In &lt;a href=&quot;http://strangelyconsistent.org/blog/ovid-is-right-roles-are-awesome&quot;&gt;a post about roles&lt;/a&gt; I explore how this helps write better programs. But really the best example nowadays is probably the Rakudo compiler and its extensive use of roles; jnthn has been writing about that in an earlier advent post.&lt;/p&gt;
&lt;p&gt;If classes abstract away complete sets of behaviors, roles abstract away partial sets of behaviors, or &lt;em&gt;responsibilities&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;You can even do so at runtime, using &lt;em&gt;mixins&lt;/em&gt;, which are roles that you add to an object as the program executes. Objects changing type during runtime sounds magic almost to the point of recklessness; but it’s all done in a very straightforward manner using anonymous subclasses.&lt;/p&gt;
&lt;h2&gt;Metaobjects&lt;/h2&gt;
&lt;p&gt;Sometimes you want extra control over how the object system itself works. The object system in Perl 6, through one of those neat bite-your-own-tail tricks, is written using itself, and is completely modifiable in terms of itself. Basically, a bunch of the complexity has been removed by not having a separate hidden, unreachable system to handle the intricacies of the object system. Instead, there’s a visible API for interacting with the object system.&lt;/p&gt;
&lt;p&gt;And, when we feel like it, we can invent new and exotic varieties of object systems. Or just tweak the existing one to our fancy.&lt;/p&gt;
&lt;h2&gt;Macros&lt;/h2&gt;
&lt;p&gt;On the way up the abstraction ladder, we’ve abstracted away bigger and bigger chunks of code: values, code, routines, behaviors, responsibilities and object systems. Now we reach the top, and there we find &lt;em&gt;macros&lt;/em&gt;. Ah, macros, these magical, inscrutable beasts. What do macros abstract away?&lt;/p&gt;
&lt;p&gt;Code.&lt;/p&gt;
&lt;p&gt;Well, that’s rather disappointing, isn’t it? Didn’t we already abstract away code with subroutines? Yes, we did. But it turns out there’s so much code in a program that sometimes, it needs to be abstracted away on several levels!&lt;/p&gt;
&lt;p&gt;Subroutines abstract away code that can then run in several different ways. You call the routine with other values, and it behaves differently. Macros abstract away code that can then be compiled in several different ways. You write a macro with other values, and it gets compiled into different code, which can then in turn run differently.&lt;/p&gt;
&lt;p&gt;Essentially, macros give you a hook into the compiler to help you shape and guide what code it emits during the compilation itself. In a sense, you’re abstracting certain parts of the compilation process, the parsing and the syntax manipulation and the code generation. Again, you’re shaping the language — but this time not inventing new nouns or verbs, but whole ways of expressing yourself.&lt;/p&gt;
&lt;p&gt;Macros come in two broad types: &lt;em&gt;textual&lt;/em&gt; (a la C) and &lt;em&gt;syntax tree&lt;/em&gt; (a la Lisp). The textual ones have a number of known issues stemming from the fact that they’re essentially a big imprecise search-and-replace on your code. The syntax tree ones are hailed as the best thing about Lisp, because it allows Lisp programs to grow and adapt to the needs of the programmer, by inventing new ways of expressing yourself.&lt;/p&gt;
&lt;p&gt;Perl 6, being Perl 6, specifies both textual macros and syntax tree macros. I’m currently working on a grant to bring syntax macros to Rakudo Perl 6. There’s &lt;a href=&quot;http://github.com/rakudo/rakudo/tree/macros&quot;&gt;a branch&lt;/a&gt; where I’m hammering out the syntax and semantics of macros. It’s fun work, and made much more feasible by the past year’s improvements to Rakudo itself.&lt;/p&gt;
&lt;h2&gt;In conclusion&lt;/h2&gt;
&lt;p&gt;As an application grows and becomes more complex, it needs more rungs of the abstraction ladder to rest on. It needs more levels of abstraction with which to draw away the specifics and focus on the generalities.&lt;/p&gt;
&lt;p&gt;Perl 6 is a new Perl, distinct from Perl 5. Its most distinguishing trait is perhaps that it has more rungs on the abstraction ladder to help you write code that’s more to the point. I like that.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1010/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/1010/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/1010/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/1010/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/1010/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/1010/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/1010/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/1010/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/1010/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/1010/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/1010/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/1010/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/1010/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/1010/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=1010&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>carl</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">Fourth Grant Report: Structured Error Messages</title>
		<link href="http://perlgeek.de/blog-en/perl-6/grant-report-errors-4.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/grant-report-errors-4.html</id>
		<updated>2011-12-19T18:28:48+00:00</updated>
		<content type="html">&lt;p&gt;Progress on my &lt;a href=&quot;http://news.perlfoundation.org/2011/02/hague-grant-application-struct.html&quot;&gt;grant
for error message&lt;/a&gt; is slow but steady. Since my last report, I've done the
following things:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Merged the &lt;code&gt;nom-exceptions&lt;/code&gt; Rakudo  branch, so now you
    can reliably throw Perl 6 objects as exceptions.&lt;/li&gt;
    &lt;li&gt;Implemented several error classes and roles in Rakudo&lt;/li&gt;
    &lt;li&gt;Started to throw typed errors both from runtime libraries and from
        inside the compiler&lt;/li&gt;
    &lt;li&gt;Hacked the default exception printer Rakudo to be much more flexible,
        for example you can now write exception classes that supress
        backtraces from the standard handler.&lt;/li&gt;
    &lt;li&gt;Wrote tests for typed run time and compile time errors, and at the
        same time developed a test function that makes it easy to write such
        tests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's time for a quick review of how far I am along the various deliverables
in the original grant proposal.&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;D1: Specification. I think the hard work here is done already,
        what remains to do is finding good default and how to manipulate them
        (for example, how to generally switch on/off printing of
        backtraces?).&lt;/li&gt;
    &lt;li&gt;D2: Error catalogue, tests: I've not worked on this one too much.
        The error classes and roles so far mostly served to exercise the
        implementation; going through the existing errors from the various
        compilers and formalizing them will be quite a bit of work, but only
        moderately complicated.&lt;/li&gt;
    &lt;li&gt;D3: Implementation, documentation. Like D1, the hard part is mostly 
        done. We can now
       throw errors from within the compiler actions and from the setting,
       next up will be the grammar. Then all places where errors are thrown
       need to be changed to use the new error classes. Again that'll be much
       work, but easy to do. Documentation is still missing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All in all I feel I'm well on the way, and most complex decisions have been
made. &lt;/p&gt;


&lt;p&gt;For a more user oriented view of the new exception system I'd like to
point you to my &lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/15/day-15-something-exceptional/&quot;&gt;Perl
    6 advent calendar post on exceptions&lt;/a&gt;.&lt;/p&gt;</content>
		<author>
			<name>Moritz Lenz</name>
			<uri>http://perlgeek.de/blog-en/</uri>
		</author>
		<source>
			<title type="html">Perlgeek.de</title>
			<subtitle type="html">Perl and Programming Blog.</subtitle>
			<link rel="self" href="http://perlgeek.de/blog-en/perl-6/index.rss"/>
			<id>http://perlgeek.de/blog-en/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">The view from the inside: using meta-programming to implement Rakudo</title>
		<link href="http://perl6advent.wordpress.com/2011/12/18/the-view-from-the-inside-using-meta-programming-to-implement-rakudo/"/>
		<id>http://perl6advent.wordpress.com/?p=1000</id>
		<updated>2011-12-18T22:49:25+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;In &lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/14/meta-programming-what-why-and-how/&quot;&gt;my previous article&lt;/a&gt; for the Perl 6 advent calendar, I looked at how we can use the meta-programming facilities of Rakudo Perl 6 in order to build a range of tools, tweak the object system to our liking or even add major new features “from the outside”. While it’s nice that you can do these things, the Perl 6 object system that you get by default is already very rich and powerful, supporting a wide range of features. Amongst them are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Classes&lt;/li&gt;
&lt;li&gt;Parametric roles&lt;/li&gt;
&lt;li&gt;Attributes&lt;/li&gt;
&lt;li&gt;Methods (including private ones)&lt;/li&gt;
&lt;li&gt;Delegation&lt;/li&gt;
&lt;li&gt;Introspection&lt;/li&gt;
&lt;li&gt;Subset (aka. refinement) types&lt;/li&gt;
&lt;li&gt;Enums&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That’s a lot of stuff to implement, but it’s all done by implementing meta-objects, and therefore we can take advantage of OOP – with both classes and roles – to factor it. The only real difference between the meta-programming we saw in my last article and the meta-programming we do while implementing the core Perl 6 object system in Rakudo is that the meta-objects are mostly written in NQP. NQP is a vastly smaller, much more easily optimizable and portable subset of Perl 6. Being able to use it also helps us to avoid many painful bootstrapping issues. Since it is mostly a small subset of Perl 6, it’s relatively easy to get in to.&lt;/p&gt;
&lt;p&gt;In this article, I want to take you inside of Rakudo and, through implementing a missing feature, give you a taste of what it’s like to hack on the core language. So, what are we going to implement? Well, one feature of roles is that they can also serve as interfaces. That is, if you write:&lt;/p&gt;
&lt;pre&gt;role Describable {
    method describe() { ... }
}
class Page does Describable {
}&lt;/pre&gt;
&lt;p&gt;Then we are meant to get a compile time error, since the class Page does not implement the method “describe”. At the moment, however, there is no error at compile time; we don’t get any kind of failure until we call the describe method at runtime. So, let’s make this work!&lt;/p&gt;
&lt;p&gt;One key thing we’re going to need to know is whether a method is just a stub, with a body containing just “…”, “???” or “!!!”. This is available to us by checking its .yada method. So, we have that bit. Question is, where to check it?&lt;/p&gt;
&lt;p&gt;Unlike classes, which have the meta-object ClassHOW by default, there  isn’t a single RoleHOW. In fact, roles show up in no less than four different forms. The two most worth knowing about are ParametricRoleHOW and ConcreteRoleHOW. Every role is born parametric. Whether you explicitly give it extra parameters or not, it is always parametric on at least the type of the invocant. Before we can ever use a role, it has to be composed into a class. Along the way, we have to specialize it, taking all the parametric things and replacing them with concrete ones. The outcome of this is a role type with a meta-object of type ConcreteRoleHOW, which is now ready for composition into the class.&lt;/p&gt;
&lt;p&gt;So that’s roles themselves, but what about composing them? Well, the actual composition is performed by two classes, RoleToClassApplier and RoleToRoleApplier. RoleToClassApplier is actually only capable of applying a single role to a class. This may seem a little odd: classes can do multiple roles, after all. However, it turns out that a neat way to factor this is to always “sum” multiple roles to a single one, and then apply that to the class. Anyway, it would seem that we need to be doing some kind of check in RoleToClassApplier. Looking through, we see this:&lt;/p&gt;
&lt;pre&gt;my @methods := $to_compose_meta.methods($to_compose, :local(1));
for @methods {
    my $name;
    try { $name := $_.name }
    unless $name { $name := ~$_ }
    unless has_method($target, $name, 1) {
        $target.HOW.add_method($target, $name, $_);
    }
}&lt;/pre&gt;
&lt;p&gt;OK, so, it’s having a bit of “fun” with, of all things, looking up the name of the method. Actually it’s trying to cope with NQP and Rakudo methods having slightly different ideas about how the name of a method is looked up. But that aside, it’s really just a loop going over the methods in a role and adding them to the class. Seems like a relatively opportune time to spot the yada case, which indicates we require a method rather than want to compose one into the class. So, we change it do this:&lt;/p&gt;
&lt;pre&gt;my @methods := $to_compose_meta.methods($to_compose, :local(1));
for @methods {
    my $name;
    my $yada := 0;
    try { $name := $_.name }
    unless $name { $name := ~$_ }
    try { $yada := $_.yada }
    if $yada {
        unless has_method($target, $name, 0) {
            pir::die(&quot;Method '$name' must be implemented by &quot; ~
            $target.HOW.name($target) ~
            &quot; because it is required by a role&quot;);
        }
    }
    elsif !has_method($target, $name, 1) {
        $target.HOW.add_method($target, $name, $_);
    }
}&lt;/pre&gt;
&lt;p&gt;A couple of notes. The first is that we’re doing binding, because NQP does not have assignment. Binding is easier to analyze and generate code for. Also, the has_method call is passing an argument of 0 or 1, which indicates whether we want to consider methods in just the target class or any of its parents (note that there’s no True/False in NQP). If the class inherits a method then we’ll consider that as good enough: it has it.&lt;/p&gt;
&lt;p&gt;So, now we run our program and we get:&lt;/p&gt;
&lt;pre&gt;===SORRY!===
Method 'describe' must be implemented by Page because it is required by a role&lt;/pre&gt;
&lt;p&gt;Which is what we were after. Note that the “SORRY!” indicates it is a compile time error. Success!&lt;/p&gt;
&lt;p&gt;So, are we done? Not so fast! First, let’s check the inherited method case works out. Here’s an example.&lt;/p&gt;
&lt;pre&gt;role Describable {
    method describe() { ... }
}
class SiteItem {
    method describe() { say &quot;It's a thingy&quot; }
}
class Page is SiteItem does Describable {
}&lt;/pre&gt;
&lt;p&gt;And…oh dear. It gives an error. Fail. So, back to RoleToClassApplier. And…aha.&lt;/p&gt;
&lt;pre&gt;sub has_method($target, $name, $local) {
    my %mt := $target.HOW.method_table($target);
    return nqp::existskey(%mt, $name)
}&lt;/pre&gt;
&lt;p&gt;Yup. It’s ignoring the $local argument. Seems it was written with the later need to do a required methods check in mind, but never implemented to handle it. OK, that’s an easy fix – we just need to go walking the MRO (that is, the transitive list of parents in dispatch order).&lt;/p&gt;
&lt;pre&gt;sub has_method($target, $name, $local) {
    if $local {
        my %mt := $target.HOW.method_table($target);
        return nqp::existskey(%mt, $name);
    }
    else {
        for $target.HOW.mro($target) {
            my %mt := $_.HOW.method_table($_);
            if nqp::existskey(%mt, $name) {
                return 1;
            }
        }
        return 0;
    }
}&lt;/pre&gt;
&lt;p&gt;With that fixed, we’re in better shape. However, you may be able to imagine another case that we didn’t yet handle. What if another role provides the method? Well, first let’s see what the current failure mode is. Here’s the code.&lt;/p&gt;
&lt;pre&gt;role Describable {
    method describe() { ... }
}
role DefaultStuff {
    method describe() { say &quot;It's a thingy&quot; }
}
class Page does Describable does DefaultStuff {
}&lt;/pre&gt;
&lt;p&gt;And here’s the failure.&lt;/p&gt;
&lt;pre&gt;===SORRY!===
Method 'describe' must be resolved by class Page because it exists
in multiple roles (DefaultStuff, Describable)&lt;/pre&gt;
&lt;p&gt;So, it’s actually considering this as a collision. So where do collisions actually get added? Happily, that just happens in one place: in RoleToRoleApplier. Here’s the code in question.&lt;/p&gt;
&lt;pre&gt;if +@add_meths == 1 {
    $target.HOW.add_method($target, $name, @add_meths[0]);
}
else {
    # More than one - add to collisions list.
    $target.HOW.add_collision($target, $name, %meth_providers{$name});
}&lt;/pre&gt;
&lt;p&gt;We needn’t worry if we just have one method and it’s a requirement rather than an actual implementation – it’ll just do the right thing. So it’s just the second branch that needs consideration. Here’s how we change things.&lt;/p&gt;
&lt;pre&gt;if +@add_meths == 1 {
    $target.HOW.add_method($target, $name, @add_meths[0]);
}
else {
    # Find if any of the methods are actually requirements, not
    # implementations.
    my @impl_meths;
    for @add_meths {
        my $yada := 0;
        try { $yada := $_.yada; }
        unless $yada {
            @impl_meths.push($_);
        }
    }

    # If there's still more than one possible - add to collisions list.
    # If we got down to just one, add it. If they were all requirements,
    # just choose one.
    if +@impl_meths == 1 {
        $target.HOW.add_method($target, $name, @impl_meths[0]);
    }
    elsif +@impl_meths == 0 {
        $target.HOW.add_method($target, $name, @add_meths[0]);
    }
    else {
        $target.HOW.add_collision($target, $name, %meth_providers{$name});
    }
}&lt;/pre&gt;
&lt;p&gt;Essentially, we filter out those that are implementations of the method rather than just requirements. If we are left with just a single method, then it’s the only implementation, and it satisfies the requirements, so we add it and we don’t need to do anything further. If we discover they are all requirements, then we don’t want to flag up a collision, but instead we just pick any of the required methods and pass it along. They’ll all give the same error. Otherwise, if we have multiple implementations, then it’s a real collision so we add it just as before. And…it works!&lt;/p&gt;
&lt;p&gt;So, we run the test suite, things look good…and commit.&lt;/p&gt;
&lt;pre&gt;3 files changed, 48 insertions(+), 6 deletions(-)&lt;/pre&gt;
&lt;p&gt;And there we go – Rakudo now supports a part of the spec that it never has before, and it wasn’t terribly much effort to put in. And that just leaves me to go to the fridge and grab a Christmas ale to relax after a little meta-hacking. Cheers!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1000/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/1000/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/1000/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/1000/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/1000/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/1000/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/1000/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/1000/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/1000/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/1000/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/1000/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/1000/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/1000/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/1000/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=1000&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 17: Gtk Mandelbrot</title>
		<link href="http://perl6advent.wordpress.com/2011/12/17/day-17-gtk-mandelbrot/"/>
		<id>http://perl6advent.wordpress.com/?p=966</id>
		<updated>2011-12-17T20:26:00+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Two years ago today, the Advent post was on &lt;a href=&quot;http://perl6advent.wordpress.com/2009/12/17/day-17-making-snowmen/&quot;&gt;making Mandelbrot sets&lt;/a&gt; in Perl 6.  At the time, they were in black and white, slow to produce, Rakudo was prone to crashing, and the only user interface thing you could control was how big the resulting PPM file was.&lt;/p&gt;
&lt;p&gt;As they say, that was then.  &lt;a href=&quot;https://github.com/colomon/mandelbrot/blob/master/bin/gtk-mandelbrot.pl&quot;&gt;This is now.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.files.wordpress.com/2011/12/big-first.png&quot;&gt;&lt;img alt=&quot;Full Mandelbrot set&quot; class=&quot;aligncenter size-full wp-image-969&quot; height=&quot;355&quot; src=&quot;http://perl6advent.files.wordpress.com/2011/12/big-first.png?w=450&amp;amp;h=355&quot; title=&quot;Full Mandelbrot set&quot; width=&quot;450&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The new &lt;a href=&quot;https://github.com/colomon/mandelbrot/blob/master/bin/gtk-mandelbrot.pl&quot;&gt;&lt;code&gt;gtk-mandelbrot.pl&lt;/code&gt;&lt;/a&gt; script is 423 lines of Perl 6 code — targeted at Niecza, threaded, and using the GtkSharp library.  It allows you to move and resize the windows, zoom in (left mouse button, drag across image to define zoom boundaries), create Julia set images (right click on a Mandelbrot set image), increase the number of iterations (press ‘m’), and output a PPM file for a window (press ‘s’).&lt;/p&gt;
&lt;p&gt;The threading doesn’t actually improve performance on my MacBook Pro (still looking into why) but it does make the script much more responsive.&lt;/p&gt;
&lt;p&gt;It would be far too long to go through all the code, but lets hit on the highlights.  The core is almost unchanged:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;        sub julia(Complex $c, Complex $z0) {
            my $z = $z0;
            my $i;
            loop ($i = 0; $i &amp;lt; $max_iterations; $i++) {
                if $z.abs &amp;gt; 2 {
                    return $i + 1;
                }
                $z = $z * $z + $c;
            }
            return 0;
        }
&lt;/pre&gt;&lt;br /&gt;
It’s named &lt;code&gt;julia&lt;/code&gt; instead of &lt;code&gt;mandel&lt;/code&gt; now, because it is more general.  If you call it with &lt;code&gt;$z0&lt;/code&gt; set to &lt;code&gt;0&lt;/code&gt;, it calculates the same thing the old &lt;code&gt;mandel&lt;/code&gt; did.  Allowing &lt;code&gt;$z0&lt;/code&gt; to vary allows you to calculate Julia sets as well.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The code around it is very different, though!  Stefan O’Rear wrote the threading code, using Niecza’s Threads library, which is a thin wrapper on C#’s threading libraries, and probably not very close to what Perl 6′s built-in threading will look like when it is ready to go.  He establishes a &lt;code&gt;WorkQueue&lt;/code&gt; with a list of the work that needs to be done, and then starts N running threads, where N comes from the environment variable THREADS if it is present, and the reported processor count otherwise:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;for ^(%*ENV&amp;lt;THREADS&amp;gt; // CLR::System::Environment.ProcessorCount) {
    Thread.new({ WorkQueue.run });
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;WorkQueue.run&lt;/code&gt; is pretty simple:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;    method run() {
        loop {
            my $item = self.shift;
            next if $item.cancelled;
            $item.run.();
            $item.mark-done;
        }
    }
&lt;/pre&gt;&lt;br /&gt;
This is an infinite loop that starts by getting the next &lt;code&gt;WorkItem&lt;/code&gt; off the queue, checks to see if it has been cancelled, and if it hasn’t, calls the .run &lt;code&gt;Callable&lt;/code&gt; attribute and then the &lt;code&gt;mark-done&lt;/code&gt; method.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;WorkItem&lt;/code&gt;s on the queue look like this:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;class WorkItem {
    has Bool $!done = False;
    has Bool $!cancelled = False;

    has Callable &amp;amp;.run;
    has Callable &amp;amp;.done-cb;

    method is-done() { WorkQueue.monitor.lock({ $!done }) }
    method mark-done() {
        &amp;amp;.done-cb.() unless WorkQueue.monitor.lock({ $!done++ })
    }

    method cancelled() { WorkQueue.monitor.lock({ $!cancelled }) }
    method cancel() { WorkQueue.monitor.lock({ $!cancelled = True }) }
}
&lt;/pre&gt;&lt;br /&gt;
Each &lt;code&gt;WorkItem&lt;/code&gt; has two flags, &lt;code&gt;$!done&lt;/code&gt; and &lt;code&gt;$!cancelled&lt;/code&gt;, and two &lt;code&gt;Callable&lt;/code&gt; attributes, &lt;code&gt;&amp;amp;.run&lt;/code&gt;, already mentioned as what is called by &lt;code&gt;WorkQueue.run&lt;/code&gt;, and &lt;code&gt;&amp;amp;.done-cb&lt;/code&gt;, which is the callback function to be called when the &lt;code&gt;&amp;amp;.run&lt;/code&gt; method finishes.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The two methods (for now) we use in our WorkItem are relatively simple:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;            sub row() {
                my $row = @rows[$y];
                my $counter = 0;
                my $counter_end = $counter + 3 * $width;
                my $c = $ur - $y * $delta * i;

                while $counter &amp;lt; $counter_end {
                    my $value = $is-julia ?? julia($julia-z0, $c) !! julia($c, 0i);
                    $row.Set($counter++, @red[$value % 72]);
                    $row.Set($counter++, @green[$value % 72]);
                    $row.Set($counter++, @blue[$value % 72]);
                    $c += $delta;
                }
            }

            sub done() {
                Application.Invoke(-&amp;gt; $ , $ {
                    $.draw-area.QueueDrawArea(0, $y, $width, 1);
                });
            }

            my $wi = WorkItem.new(run =&amp;gt; &amp;amp;row, done-cb =&amp;gt; &amp;amp;done);
            WorkQueue.push($wi);
            push @.line-work-items, $wi;
&lt;/pre&gt;&lt;br /&gt;
As you might expect, &lt;code&gt;row&lt;/code&gt; calculates one line of the set we are working on.  It may look like it is using global variables, but these subs are actually local to the &lt;code&gt;FractalSet.start-work&lt;/code&gt; method and the variables are local to it from there.  The &lt;code&gt;done&lt;/code&gt; invokes a Gtk function noting that a portion of the window needs to be redrawn (namely the portion we just calculated).&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The above block of code is called once for each row of the fractal window being generated, which has the effect of queuing up all of the fractal to be handled as there are available threads.&lt;/p&gt;
&lt;p&gt;Moving upward in the code's organization, each fractal window we generate is managed by an instance of the  &lt;code&gt;FractalSet&lt;/code&gt; class.&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;class FractalSet {
    has Bool $.is-julia;
    has Complex $.upper-right;
    has Real $.delta;
    has Int $.width;
    has Int $.height;
    has Int $.max_iterations;
    has Complex $.c;
    has @.rows;
    has @.line-work-items;
    has $.new-upper-right;

    has $.draw-area;
&lt;/pre&gt;&lt;br /&gt;
&lt;code&gt;$.is-julia&lt;/code&gt; and &lt;code&gt;$.max_iterations&lt;/code&gt; are self-explanatory.  &lt;code&gt;$.upper-right&lt;/code&gt; is the fixed complex number anchoring the image.  &lt;code&gt;$.delta&lt;/code&gt; is the amount of change in the previous number per-pixel; we assume the pixels are square.  &lt;code&gt;$.width&lt;/code&gt; and &lt;code&gt;$.height&lt;/code&gt; are the size of the window in pixels.  &lt;code&gt;$.c&lt;/code&gt; only has meaning for Julia sets, where it is the value &lt;code&gt;$c&lt;/code&gt; in the equation &lt;code&gt;$new-z = $z * $z + $c&lt;/code&gt;.  &lt;code&gt;@.rows&lt;/code&gt; the pixel information generated by the &lt;code&gt;row&lt;/code&gt; sub above; &lt;code&gt;@.line-work-items&lt;/code&gt; saves a reference to all of the &lt;code&gt;WorkItem&lt;/code&gt;s generating those rows.  &lt;code&gt;$.new-upper-right&lt;/code&gt; is temporary used during the zoom mouse operation.  &lt;code&gt;$.draw-area&lt;/code&gt; is the &lt;code&gt;Gtk.DrawingArea&lt;/code&gt; for the related window.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Once all that is set up, the rest of the code is pretty straightforward.  The Gtk windowing code is set up in &lt;code&gt;FractalSet.build-window&lt;/code&gt;:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;    method build-window()
    {
        my $index = +@windows;
        @windows.push(self);
        self.start-work;

        my $window = Window.new($.is-julia ?? &quot;julia $index&quot; !! &quot;mandelbrot $index&quot;);
        $window.SetData(&quot;Id&quot;, SystemIntPtr.new($index));
        $window.Resize($.width, $.height);  # TODO: resize at runtime NYI

        my $event-box = GtkEventBox.new;
        $event-box.SetData(&quot;Id&quot;, SystemIntPtr.new($index));
        $event-box.add_ButtonPressEvent(&amp;amp;ButtonPressEvent);
        $event-box.add_ButtonReleaseEvent(&amp;amp;ButtonReleaseEvent);

        my $drawingarea = $.draw-area = GtkDrawingArea.new;
        $drawingarea.SetData(&quot;Id&quot;, SystemIntPtr.new($index));
        $drawingarea.add_ExposeEvent(&amp;amp;ExposeEvent);
        $window.add_DeleteEvent(&amp;amp;DeleteEvent);
        $event-box.Add($drawingarea);

        $window.Add($event-box);
        $window.add_KeyReleaseEvent(&amp;amp;KeyReleaseEvent);
        $window.ShowAll;
    }
&lt;/pre&gt;&lt;br /&gt;
We store a global array &lt;code&gt;@windows&lt;/code&gt; tracking all the &lt;code&gt;FractalSet&lt;/code&gt;s in play.  Each of the different objects here gets the &lt;code&gt;&quot;Id&quot;&lt;/code&gt; data set to this set's index into the &lt;code&gt;@windows&lt;/code&gt; array so we can easily look up the &lt;code&gt;FractalSet&lt;/code&gt; from callback functions.  The rest of the method is just plugging the right callback into each component -- simple conceptually but it took this Gtk novice a lot of work figuring it all out.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As an example, consider the &lt;code&gt;KeyReleaseEvent&lt;/code&gt; callback, which responds to presses on the keyboard.&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;sub KeyReleaseEvent($obj, $args) {
    my $index = $obj.GetData(&quot;Id&quot;).ToInt32();
    my $set = @windows[$index];
    
    given $args.Event.Key {
        when 'm' | 'M' {
            $set.increase-max-iterations;
        }
        when 's' | 'S' {
            $set.write-file;
        }
    }
}
&lt;/pre&gt;&lt;br /&gt;
First we lookup the index into &lt;code&gt;@windows&lt;/code&gt;, then we get the &lt;code&gt;$set&lt;/code&gt; we're looking at.  Then we just call the appropriate &lt;code&gt;FractalSet&lt;/code&gt; method, for instance&lt;br /&gt;
&lt;pre class=&quot;brush: plain;&quot;&gt;    method increase-max-iterations() {
        self.stop-work;
        $.max_iterations += 32;
        self.start-work;
    }
&lt;/pre&gt;&lt;br /&gt;
&lt;code&gt;.stop-work&lt;/code&gt; cancels all the pending operations for this FractalSet, then we bump up the number of iterations, and then we &lt;code&gt;.start-work&lt;/code&gt; again to queue up a new set of rows with the new values.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The full &lt;a href=&quot;https://github.com/colomon/mandelbrot/blob/master/bin/gtk-mandelbrot.pl&quot;&gt;source code is here.&lt;/a&gt;  As of this writing it agrees with the code here, but this is an active project, and probably will change again in the not-too-distant future.  Right now my biggest goals are figuring out how to get the threading to actually improve performance on my MacBook Pro and cleaning up the code.  Both suggestions and questions are welcome.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/966/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/966/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/966/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/966/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/966/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/966/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/966/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/966/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/966/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/966/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/966/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/966/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/966/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/966/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=966&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>colomon</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Where Have All The References Gone?</title>
		<link href="http://perl6advent.wordpress.com/2011/12/16/where-have-all-the-references-gone/"/>
		<id>http://perl6advent.wordpress.com/?p=960</id>
		<updated>2011-12-16T14:00:59+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Perl 5 programmers that start to learn Perl 6 often ask me how to take a reference to something, and my answers usually aren’t really helpful.  In Perl 6, everything that can be held in a variable is an object, and objects are passed by reference everywhere (though you don’t always notice that, because objects like strings and numbers are immutable, so there’s no difference to passing by value). So, everything is already treated as a reference in some sense, and there’s no point in explicitly taking references.&lt;/p&gt;
&lt;p&gt;But people aren’t happy with that answer, because it doesn’t explain how to get stuff done that involved references in Perl 5. So here are a few typical use cases of references, and how Perl 6 handles them.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a name=&quot;creating_objects&quot;&gt;Creating Objects&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Perl 5, an object is really just a reference to a blessed value (but people usually say &quot;blessed reference&quot;, because you virtually never use the blessed value without going through a reference).&lt;/p&gt;
&lt;p&gt;So, in Perl 5 you’d write&lt;/p&gt;
&lt;pre&gt; package My::Class;
 # constructor
 sub new { bless {}, shift };
 # an accessor
 sub foo {
     my $self = shift;
     # the -&amp;gt;{} dereferences $self as a hash
     $self-&amp;gt;{foo} // 5;
 }&lt;/pre&gt;
&lt;pre&gt; # use the object:
 say My::Class-&amp;gt;new-&amp;gt;foo;&lt;/pre&gt;
&lt;p&gt;In Perl 6, you just don’t think about references; classes are much more declarative, and there’s no need for dereferencing anything anywhere:&lt;/p&gt;
&lt;pre&gt; class My::Class {
     # attribute with accessor (indicated by the dot)
     # and default value
     has $.foo = 5;
 }&lt;/pre&gt;
&lt;pre&gt; # use it:
 say My::Class.new.foo&lt;/pre&gt;
&lt;p&gt;If you don’t like the default constructor, you can still use &lt;code&gt;bless&lt;/code&gt; explicitly, but even then you don’t have to think about references:&lt;/p&gt;
&lt;pre&gt; method new() {
     # the * specifies the storage, and means &quot;default storage&quot;
     self.bless(*);
 }&lt;/pre&gt;
&lt;p&gt;So, no explicit reference handling when dealing with OO. Great.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a name=&quot;nested_data_structures&quot;&gt;Nested Data Structures&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In both Perl 5 and Perl 6, lists flatten automatically by default. So if you write&lt;/p&gt;
&lt;pre&gt; my @a = (1, 2);
 my @b = (3, 4);
 push @a, @b&lt;/pre&gt;
&lt;p&gt;then &lt;code&gt;@a&lt;/code&gt; ends up with the four elements &lt;code&gt;1, 2, 3, 4&lt;/code&gt;, not with three elements of which the third is an array.&lt;/p&gt;
&lt;p&gt;In Perl 5, nesting the data structure happens by taking a reference to &lt;code&gt;@b&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt; push @a, \@b;&lt;/pre&gt;
&lt;p&gt;In Perl 6, item context replaces this use of references. It is best illustrated by a rather clumsy method to achieve the same thing:&lt;/p&gt;
&lt;pre&gt; my $temp = @b;
 push @a, $temp;  # does not flatten the two items in $temp,
                 # because $temp is a scalar&lt;/pre&gt;
&lt;p&gt;Of course there are shortcuts; the following lines work too:&lt;/p&gt;
&lt;pre&gt; push @a, $(@b);
 push @a, item @b;&lt;/pre&gt;
&lt;p&gt;(As a side note, &lt;code&gt;push @a, $@b&lt;/code&gt; is currently not allowed, it tries to catch a p5ism; I will also try to persuade Larry and the other language designers to allow it, and have it mean the same thing as the other two).&lt;/p&gt;
&lt;p&gt;On the flip side you need explicit dereferencing to get the values out of item context:&lt;/p&gt;
&lt;pre&gt; my @a = 1, 2;
 my $scalar = @a;
 for @a {
     # two iterations
 }
 for $scalar {
     # one iteration only
 }
 for @$scalar {
     # two iterations again
 }&lt;/pre&gt;
&lt;p&gt;This explicit use of scalar and list context is the closest analogy to Perl 5 references, because it requires explicit context annotations in the same places where referencing and dereferencing is used in Perl 5.&lt;/p&gt;
&lt;p&gt;But it’s not really the same, because there are cases where Perl 5 needs references, but Perl 6 can deduce the item context all on its own:&lt;/p&gt;
&lt;pre&gt; @a[3] = @b; # automatically puts @b in item context&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a name=&quot;mutating_arguments&quot;&gt;Mutating Arguments&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Another use references in Perl 5 is for passing data to routines that should be modified inside the routine:&lt;/p&gt;
&lt;pre&gt; sub set_five; {
     my $x = shift;
     # explicit dereferencing with another $:
     $$x = 5;
 }
 my $var;
 # explicit taking of a reference
 set_five \$var;&lt;/pre&gt;
&lt;p&gt;In Perl 6, there is a separate mechanism for this use case:&lt;/p&gt;
&lt;pre&gt; sub set_five($x is rw) {
     # no dereferencing
     $x = 5;
 }
 my $var;
 # no explicit reference taking
 set_five $var;&lt;/pre&gt;
&lt;p&gt;So again a use case of Perl 5 references is realized by another mechanism in Perl 6 (signature binding, or binding in general).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a name=&quot;summary&quot;&gt;Summary&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Nearly everything is a reference in Perl 6, but you still don’t see them, unless you take a very close look. The control of list flattening with item and list context is the one area where Perl 5′s referencing and dereferencing shines through the most.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/960/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/960/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/960/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/960/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/960/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/960/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/960/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/960/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/960/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/960/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/960/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/960/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/960/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/960/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=960&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>Moritz</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 15 – Something Exceptional</title>
		<link href="http://perl6advent.wordpress.com/2011/12/15/day-15-something-exceptional/"/>
		<id>http://perl6advent.wordpress.com/?p=956</id>
		<updated>2011-12-15T12:39:31+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;The Perl 6 exception system is currently in development; here is a small example demonstrating a part of the current state:&lt;/p&gt;
&lt;pre&gt; use v6;

 sub might_die(Real $x) {
     die &quot;negative&quot; if $x &amp;lt; 0;
     $x.sqrt;
 }

 for 5, 0, -3, 1+2i -&amp;gt; $n {
     say &quot;The square root of $n is &quot;, might_die($n);

     CATCH {
         # CATCH sets $_ to the error object,
         # and then checks the various cases:
         when 'negative' {
             # note that $n is still in scope,
             # since the CATCH block is *inside* the
             # to-be-handled block
             say &quot;Cannot take square root of $n: negative&quot;
         }
         default {
             say &quot;Other error: $_&quot;;
         }
     }
 }&lt;/pre&gt;
&lt;p&gt;This produces the following output under rakudo:&lt;/p&gt;
&lt;pre&gt; The square root of 5 is 2.23606797749979
 The square root of 0 is 0
 Cannot take square root of -3: negative
 Other error: Nominal type check failed for parameter '$x'; expected Real but got Complex instead&lt;/pre&gt;
&lt;p&gt;A few interesting points: the presence of a &lt;code&gt;CATCH&lt;/code&gt; block automatically makes the surrounding block catch exceptions. Inside the &lt;code&gt;CATCH&lt;/code&gt; block, all lexical variables from the outside are normally accessible, so all the interesting information is available for error processing.&lt;/p&gt;
&lt;p&gt;Inside the &lt;code&gt;CATCH&lt;/code&gt; block, the error object is available in the &lt;code&gt;$_&lt;/code&gt; variable, on the outside it is available in &lt;code&gt;$!&lt;/code&gt;. If an exception is thrown inside a &lt;code&gt;CATCH&lt;/code&gt; block, it is not caught — unless there is a second, inner &lt;code&gt;CATCH&lt;/code&gt; that handles it.&lt;/p&gt;
&lt;p&gt;The insides of a &lt;code&gt;CATCH&lt;/code&gt; block typically consists of &lt;code&gt;when&lt;/code&gt; clauses, and sometimes a &lt;code&gt;default&lt;/code&gt; clause. If any of those matches the error object, the error is considered to be handled. If no clause matches (and no &lt;code&gt;default&lt;/code&gt; block is present), the exception is rethrown.&lt;/p&gt;
&lt;p&gt;Comparing the output from rakudo to the one that niecza produces for the same code, one can see that the last line differs:&lt;/p&gt;
&lt;pre&gt; Other error: Nominal type check failed in binding Real $x in might_die; got Complex, needed Real&lt;/pre&gt;
&lt;p&gt;This higlights a problem in the current state: The wording of error messages is not yet specified, and thus differs among implementations.&lt;/p&gt;
&lt;p&gt;I am working on rectifying that situation, and also throwing interesting types of error objects. In the past week, I have managed to start throwing specific error objects from within the Rakudo compiler. Here is an example:&lt;/p&gt;
&lt;pre&gt; $ ./perl6 -e 'try eval q[ class A { $!x } ]; say &quot;error: $!&quot;; say $!.perl'
 error: Attribute $!x not declared in class A
 X::Attribute::Undeclared.new(
         name =&amp;gt; &quot;\$!x&quot;,
         package-type =&amp;gt; &quot;class&quot;,
         package-name =&amp;gt; &quot;A&quot;, filename =&amp;gt; &quot;&quot;,
         line =&amp;gt; 1,
         column =&amp;gt; Any,
         message =&amp;gt; &quot;Attribute \$!x not declared in class A&quot;
 )
 # output reformatted for clarity&lt;/pre&gt;
&lt;p&gt;The string that is passed to &lt;code&gt;eval&lt;/code&gt; is not a valid Perl 6 program, because it accesses an attribute that wasn’t declared in class &lt;code&gt;A&lt;/code&gt;. The exception thrown is of type &lt;code&gt;X::Attribute::Undeclared&lt;/code&gt;, and it contains several details: the name of the attribute, the type of package it was missing in (could be class, module, grammar and maybe others), the name of the package, the actual error message and information about the source of the error (line, cfile name (empty because &lt;code&gt;eval()&lt;/code&gt; operates on a string, not on a file), and column, though column isn’t set to a useful value yet).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;X::Attribute::Undeclared&lt;/code&gt; inherits from type &lt;code&gt;X::Comp&lt;/code&gt;, which is the common superclass for all compile time errors. Once all compile time errors in Rakudo are switched to &lt;code&gt;X::Comp&lt;/code&gt; objects, one will be able to check if errors were produced at run time or at compile with code like&lt;/p&gt;
&lt;pre&gt; eval $some-string;
 CATCH {
     when X::Comp { say 'compile time' }
     default      { say 'run time'     }
 }&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;when&lt;/code&gt; block smart-matches the error object against the &lt;code&gt;X::Comp&lt;/code&gt; type object, which succeeds whenever the error object conforms to that type (so, is of that type or a subclas of &lt;code&gt;X::Comp&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Writing and using new error classes is quite easy:&lt;/p&gt;
&lt;pre&gt; class X::PermissionDenied is X::Base {
     has $.reason;
     method message() { &quot;Permission denied: $.reason&quot; };
 }&lt;/pre&gt;
&lt;pre&gt; # and using it somewhere:
 die X::PermissionDenied.new( reason =&amp;gt; &quot;I don't like your nose&quot;);&lt;/pre&gt;
&lt;p&gt;So Perl 6 has a rather flexible error handling mechanism, and libraries and applications can choose to throw error objects with rich information.  The plan is to have the Perl 6 compilers throw such easily introspectable error objects too, and at the same time unify their error messages.&lt;/p&gt;
&lt;p&gt;Many thanks go to Ian Hague and The Perl Foundation for funding my work on exceptions.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/956/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/956/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/956/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/956/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/956/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/956/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/956/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/956/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/956/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/956/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/956/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/956/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/956/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/956/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=956&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>Moritz</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Meta-programming: what, why and how</title>
		<link href="http://perl6advent.wordpress.com/2011/12/14/meta-programming-what-why-and-how/"/>
		<id>http://perl6advent.wordpress.com/?p=949</id>
		<updated>2011-12-14T21:55:48+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Sometimes, it’s good to take ones understanding of a topic, throw it away and try to build a new mental model of it from scratch. I did that in the last couple of years with object orientation. Some things feel ever so slightly strange to let go of and re-evaluate. For many people, an object really is “an instance of a class” and inheritance really is a core building block of OOP. I suspect many people who read this post will at this point be thinking, “huh, of course they really are” – and if so, that’s totally fair enough. Most people’s view of OOP will, naturally, be based around the languages they’ve applied object orientation in, and most of the mainstream languages really do have objects that are instances of classes and really do have inheritance as a core principle.&lt;/p&gt;
&lt;p&gt;Step back and look around, however, and things get a bit more blurry. JavaScript doesn’t have any notion of classes. CLOS (the Common Lisp Object System) does have classes, but they don’t have methods. And even if we do just stick with the languages that have classes with methods, there’s a dizzying array of “extras” playing their part in the language’s OO world view; amongst them are interfaces, mixins and roles.&lt;/p&gt;
&lt;p&gt;Roles – more often known as traits in the literature – are a relatively recent arrival on the OO scene, and they serve as an important reminder than object orientation is not finished yet. It’s a living, breathing paradigm, undergoing its own evolution just as our programming languages in general are.&lt;/p&gt;
&lt;p&gt;And that brings me nicely on to Perl 6 – a language that from the start has set out to be able to evolve. At a syntax level, that’s done by opening up the grammar to mutation – in a very carefully controlled way, such that you always know what language any given lexical scope is in. Meta-programming plays that same role, but in the object orientation and type system space.&lt;/p&gt;
&lt;p&gt;So what is a meta-object? A meta-object is simply an object that describes how a piece of our language works. What sorts of things in Perl 6 have meta-objects? Here’s a partial list.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Classes&lt;/li&gt;
&lt;li&gt;Roles&lt;/li&gt;
&lt;li&gt;Subsets&lt;/li&gt;
&lt;li&gt;Enumerations&lt;/li&gt;
&lt;li&gt;Attributes&lt;/li&gt;
&lt;li&gt;Subroutines&lt;/li&gt;
&lt;li&gt;Methods&lt;/li&gt;
&lt;li&gt;Signatures&lt;/li&gt;
&lt;li&gt;Parameters&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So that’s meta-objects, but what about the protocol? You can read protocol as “API” or “interface”. It’s an agreed set of methods that a meta-object will provide if it wants to expose certain features. Let’s consider the API for anything that can have methods, such as classes and roles. At a minimum, it will provide:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;add_method – adds a method to the object&lt;/li&gt;
&lt;li&gt;methods – enables introspection of the methods that the object has&lt;/li&gt;
&lt;li&gt;method_table – provides a hash of the methods in this type, excluding any that may be inherited&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What about something that you can call a method on? It just has to provide one thing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;find_method – takes an object and a name, and returns the method if one exists&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By now you may be thinking, “wait a moment, is there something that you can call a method on, but that does not have methods”? And the answer is – yes. For example, an enum has values that you can call a method on – the methods that the underlying type of the enumeration provides. You can’t actually add a method to an enum itself, however.&lt;/p&gt;
&lt;p&gt;What’s striking about this is that we are now doing object oriented programming…to implement our object oriented language features. And this in turn means that we can tweak and extend our language – perhaps by subclassing an existing meta-object, or even by writing a new one from scratch. To demonstrate this, we’ll do a simple example, then a trickier one.&lt;/p&gt;
&lt;p&gt;Suppose we wanted to forbid multiple inheritance. Here’s the code that we need to write.&lt;/p&gt;
&lt;pre&gt;my class SingleInheritanceClassHOW
    is Mu is Metamodel::ClassHOW
{
    method add_parent(Mu $obj, Mu $parent) {
        if +self.parents($obj, :local) &amp;gt; 0 {
            die &quot;Multiple inheritance is forbidden!&quot;;
        }
        callsame;
    }
}
my module EXPORTHOW { }
EXPORTHOW.WHO.&amp;lt;class&amp;gt; = SingleInheritanceClassHOW;&lt;/pre&gt;
&lt;p&gt;What are we doing here? First, we inherit from the standard Perl 6 implementation of classes, which is defined by the class Metamodel::ClassHOW. (For now, we also inherit from Mu, since meta-objects currently consider themselves outside of the standard type hierarchy. This may change.) We then override the add_parent method, which is called whenever we want to add a parent to a class. We check the current number of (local) parents that a class has; if it already has one, then we die. Otherwise, we use callsame in order to just call the normal add_parent method, which actually adds the parent.&lt;/p&gt;
&lt;p&gt;You may wonder what the $obj parameter that we’re taking is, and why it is needed. It is there because if we were implementing a prototype model of OOP, then adding a method to an object would operate on the individual object, rather than stashing the method away in the meta-object.&lt;/p&gt;
&lt;p&gt;Finally, we need to export our new meta-object to anything that uses our module, so that it will be used in place of the “class” package declarator. Do do this, we stick it in the EXPORTHOW module, under the name “class”. The importer pays special attention to this module, if it exists. So, here it is in action, assuming we put our code in a module si.pm. This program works as usual:&lt;/p&gt;
&lt;pre&gt;use si;
class A { }
class B is A { }&lt;/pre&gt;
&lt;p&gt;While this one:&lt;/p&gt;
&lt;pre&gt;class A { }
class B { }
class C is A is B { }&lt;/pre&gt;
&lt;p&gt;Will die with:&lt;/p&gt;
&lt;pre&gt;===SORRY!===
Multiple inheritance is forbidden!&lt;/pre&gt;
&lt;p&gt;At compile time.&lt;/p&gt;
&lt;p&gt;Now for the trickier one. Let’s do a really, really simple implementation of aspect oriented programming. We’ll write an aspects module. First, we declare a class that we’ll use to mark aspects.&lt;/p&gt;
&lt;pre&gt;my class MethodBoundaryAspect is export {
}&lt;/pre&gt;
&lt;p&gt;Next, when a class is declared with “is SomeAspect”, where SomeAspect inherits from MethodBoundaryAspect, we don’t want to treat it as inheritance. Instead, we’d like to add it to a list of aspects. Here’s an extra trait modifier to do that.&lt;/p&gt;
&lt;pre&gt;multi trait_mod:(Mu:U $type, MethodBoundaryAspect:U $aspect) is export {
    $aspect === MethodBoundaryAspect ??
        $type.HOW.add_parent($type, $aspect) !!
        $type.HOW.add_aspect($type, $aspect);
}&lt;/pre&gt;
&lt;p&gt;We take care to make sure that the declaration of aspects themselves – which will directly derive from this class – still works out by continuing to call add_parent for those. Otherwise, we call a method add_aspect, which we’ll define in a moment.&lt;/p&gt;
&lt;p&gt;Supposing that our aspects work by optionally implementing entry and exit methods, which get passed the details of the call, here’s our custom meta-class, and the code to export it, just as before.&lt;/p&gt;
&lt;pre&gt;my class ClassWithAspectsHOW
    is Mu is Metamodel::ClassHOW
{
    has @!aspects;
    method add_aspect(Mu $obj, MethodBoundaryAspect:U $aspect) {
        @!aspects.push($aspect);
    }
    method compose(Mu $obj) {
        for @!aspects -&amp;gt; $a {
        for self.methods($obj, :local) -&amp;gt; $m {
            $m.wrap(-&amp;gt; $obj, |$args {
                $a.?entry($m.name, $obj, $args);
                my $result := callsame;
                $a.?exit($m.name, $obj, $args, $result);
                $result
            });
        }
        }
        callsame;
    }
}
my module EXPORTHOW { }
EXPORTHOW.WHO.&amp;lt;class&amp;gt; = ClassWithAspectsHOW;&lt;/pre&gt;
&lt;p&gt;Here, we see how add_aspect is implemented – it just pushes the aspect onto a list. The magic all happens at class composition time. The compose method is called after we’ve parsed the closing curly of a class declaration, and is the point at which we finalize things relating to the class declaration. Ahead of that, we loop over any aspects we have, and the wrap each method declared in the class body up so that it will make the call to the entry and exit methods.&lt;/p&gt;
&lt;p&gt;Here’s an example of the module in use.&lt;/p&gt;
&lt;pre&gt;use aspects;
class LoggingAspect is MethodBoundaryAspect {
    method entry($method, $obj, $args) {
        say &quot;Called $method with $args&quot;;
    }
    method exit($method, $obj, $args, $result) {
        say &quot;$method returned with $result.perl()&quot;;
    }
}
class Example is LoggingAspect {
    method double($x) { $x * 2 }
    method square($x) { $x ** 2 }
}
say Example.double(3);
say Example.square(3);&lt;/pre&gt;
&lt;p&gt;And the output is:&lt;/p&gt;
&lt;pre&gt;Called double with 3
double returned with 6
6
Called square with 3
square returned with 9
9&lt;/pre&gt;
&lt;p&gt;So, a module providing basic aspect orientation support in 30 or so lines. Not so bad.&lt;/p&gt;
&lt;p&gt;As you can imagine, we can go a long way with meta-programming, whether we want to create policies, development tools (like Grammar::Debugger) or try to add entirely new concepts to our language. Happy meta-hacking.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/949/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/949/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/949/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/949/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/949/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/949/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/949/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/949/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/949/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/949/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/949/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/949/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/949/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/949/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=949&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Bailador — A small Dancer clone</title>
		<link href="http://perl6advent.wordpress.com/2011/12/13/bailador-a-small-dancer-clone/"/>
		<id>http://perl6advent.wordpress.com/?p=940</id>
		<updated>2011-12-13T18:58:49+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Today we’ll write a simple Dancer clone in Perl 6. Simple also means Very Minimal — it will only recognize basic GET requests. Let’s look at how the simplest Dancer app possible looks like:&lt;/p&gt;
&lt;pre&gt;    get '/' =&amp;gt; sub {
        &quot;Hello World!&quot;
    };
    dance;&lt;/pre&gt;
&lt;p&gt;So we need something to add routes to our app, and something to run it. Let’s take care of adding routes first. We’ll create an array to store all those, and thus &lt;code&gt;get()&lt;/code&gt; will just add them to it.&lt;/p&gt;
&lt;pre&gt;    my @routes;
    sub get(Pair $x) is export {
        @routes.push: $x;
    }&lt;/pre&gt;
&lt;p&gt;In case you’re not familiar with the &lt;code&gt;Pair&lt;/code&gt; thing, in Perl 6 a fat comma (&lt;code&gt;=&amp;gt;&lt;/code&gt;) creates an actual data structure containing a key and a value. In this case, the key is just a string ‘/’, and the value is a subroutine.&lt;/p&gt;
&lt;p&gt;Having &lt;code&gt;@routes&lt;/code&gt; being a simple array of keys and values we can now write a simple dispatcher:&lt;/p&gt;
&lt;pre&gt;    sub dispatch($env) {
        for @routes -&amp;gt; $r {
            if $env&amp;lt;REQUEST_URI&amp;gt; ~~ $r.key {
                return $r.value.();
            }
        }
        return &quot;404&quot;;
    }&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;dispatch()&lt;/code&gt; takes a hash representing our environment, which contains the &lt;code&gt;REQUEST_URI&lt;/code&gt; string, basing on which we’ll try to find an appropriate candidate to dispatch to.&lt;/p&gt;
&lt;p&gt;The above example is also cheating a bit: it just returns a ’404′ string instead of creating a proper HTTP response. Making it respond properly is left as an exercise for the reader (not the last one in this short article, I assure you :)).&lt;/p&gt;
&lt;p&gt;Since we got that far already, writing our own &lt;code&gt;dance()&lt;/code&gt; is a piece of cake. We’re going to call it &lt;code&gt;baile()&lt;/code&gt; though. Why do we write all this in Spanish? If you can guess on which classes I was bored and wrote this thing on a piece of paper, then on the next YAPC I’ll show you the fastest possible way to tie a shoe. No kidding! But let’s finish this thing first.&lt;/p&gt;
&lt;p&gt;Luckily we don’t need to write our own web server now. We have &lt;code&gt;HTTP::Server::Simple::PSGI&lt;/code&gt; in Perl 6, which will do most of the hard work for us. The only thing we have to do is to create a PSGI app. In case you’ve never heard of it, a PSGI app is a mere subroutine, taking the environment as an argument, and returning an array of three things: an HTTP response code, an array of HTTP headers and a response body. Once we have our PSGI app ready, we just feed &lt;code&gt;HTTP::Server::Simple::PSGI&lt;/code&gt; with it, and we’re good to go.&lt;/p&gt;
&lt;pre&gt;    sub baile is export {
        my $app = sub($env) {
            my $res = dispatch($env);
            return ['200', [ 'Content-Type' =&amp;gt; 'text/plain' ], $res];
        }

        given HTTP::Server::Simple.PSGI.new {
            .host = 'localhost';
            .app($app);
            .run;
        }
    }&lt;/pre&gt;
&lt;p&gt;Yep, we’re cheating again and returning &lt;code&gt;200&lt;/code&gt; no matter what. Remember the part about “an exercise for the reader?” You can think about it while celebrating a working Dancer clone.&lt;/p&gt;
&lt;h2&gt;But wait, there’s more!&lt;/h2&gt;
&lt;p&gt;Let’s look at our &lt;code&gt;dispatch()&lt;/code&gt; once again:&lt;/p&gt;
&lt;pre&gt;    sub dispatch($env) {
        for @routes -&amp;gt; $r {
            if $env&amp;lt;REQUEST_URI&amp;gt; ~~ $r.key {
                return $r.value.();
            }
        }
        return &quot;404&quot;;
    }&lt;/pre&gt;
&lt;p&gt;You probably noticed that we’ve used &lt;code&gt;~~&lt;/code&gt; — a smartmatching operator. Thanks to that, we can match &lt;code&gt;REQUEST_URI&lt;/code&gt; against strings, but not only. &lt;code&gt;Junctions&lt;/code&gt; will work fine too:&lt;/p&gt;
&lt;pre&gt;    get any('/h', '/help', '/halp') =&amp;gt; sub {
        &quot;A helpful help message&quot;
    }&lt;/pre&gt;
&lt;p&gt;And regexes:&lt;/p&gt;
&lt;pre&gt;    get /greet\/(.+)/ =&amp;gt; sub ($x) {
        &quot;Welcome $x&quot;
    }&lt;/pre&gt;
&lt;p&gt;The last one will need a bit of tweaking in &lt;code&gt;dispatch()&lt;/code&gt;. Yes, &lt;code&gt;~~&lt;/code&gt; does the regex matching for us, but we have to take care of passing the match results to the callback function. Let’s modify the &lt;code&gt;if&lt;/code&gt; body then:&lt;/p&gt;
&lt;pre&gt;    sub dispatch($env) {
        for @routes -&amp;gt; $r {
            if $env&amp;lt;REQUEST_URI&amp;gt; ~~ $r.key {
                if $/ {
                    return $r.value.(|$/.list);
                } else {
                    return $r.value.();
                }
            }
        }
        return &quot;404&quot;;
    }&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;if $/&lt;/code&gt; part checks whether the match resulted in setting the &lt;code&gt;Match&lt;/code&gt; object in the &lt;code&gt;$/&lt;/code&gt; variable. If it did, we flatten the &lt;code&gt;Match&lt;/code&gt; to a list, and pass it to the callback function. We need a &lt;code&gt;|&lt;/code&gt; prefix, so it becomes expanded to a parameter list instead of being passed as a mere array. From now on, the above example with &lt;code&gt;greet&lt;/code&gt; will Just Work. Yay!&lt;/p&gt;
&lt;p&gt;The Bailador code presented here is available &lt;a href=&quot;https://github.com/tadzik/bailador&quot; title=&quot;Bailador on github&quot;&gt;in the Github repository&lt;/a&gt;. If you feel challenged by the “exercises for the reader”, or just want to make it a bit more proper Dancer port, you’re welcome to hack on it a bit and contribute. I hope I showed you how simple it is to write a simple, yet useful thing, and going with those simple steps we can hopefully get to something close to a full-blown Dancer port. Happy hacking, and have an appropriate amount of fun!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/940/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/940/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/940/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/940/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/940/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/940/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/940/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/940/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/940/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/940/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/940/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/940/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/940/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/940/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=940&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>ttjjss</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Privacy and OOP</title>
		<link href="http://perl6advent.wordpress.com/2011/12/11/privacy-and-oop/"/>
		<id>http://perl6advent.wordpress.com/?p=880</id>
		<updated>2011-12-11T21:31:55+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;There are a number of ways in which Perl 6 encourages you to restrict the scope of elements of your program. By doing so, you can better understand how they are used and will be able to refactor them more easily later, potentially aiding agility. Lexical scoping is one such mechanism, and subroutines are by default lexically scoped.&lt;/p&gt;
&lt;p&gt;Let’s take a look at a class that demonstrates some of the object oriented related privacy mechanisms.&lt;/p&gt;
&lt;pre&gt;    class Order {
        my class Item {
            has $.name;
            has $.price;
        }

        has Item @!items;

        method add_item($name, $price) {
            @!items.push(Item.new(:$name, :$price))
        }

        method discount() {
            self!compute_discount()
        }

        method total() {
            self!compute_subtotal() - self!compute_discount();
        }

        method !compute_subtotal() {
            [+] @!items&amp;gt;&amp;gt;.price
        }

        method !compute_discount() {
            my $sum = self!compute_subtotal();
            if $sum &amp;gt;= 1000 {
                $sum * 0.15
            }
            elsif $sum &amp;gt;= 100 {
                $sum * 0.1
            }
            else {
                0
            }
        }
    }&lt;/pre&gt;
&lt;p&gt;Taking a look at this, the first thing we notice is that Item is a lexical class. A class declared with “my” scope can never be referenced outside of the scope it is declared within. In our case, we never leak instances of it outside of our Order class either. This makes our class an example of the aggregate pattern: it prevents outside code from holding direct references to the things inside of it. Should we ever decide to change the way that our class represents its items on the inside, we have complete freedom to do so.&lt;/p&gt;
&lt;p&gt;The other example of a privacy mechanism at work in this class is the use of private methods. A private method is declared just like an ordinary method, but with an exclamation mark appearing before its name. This gives it the same visibility as an attribute (which, you’ll note, are also declared with an exclamation mark – a nice bit of consistency). It also means you need to call it differently, using the exclamation mark instead of the dot.&lt;/p&gt;
&lt;p&gt;Private methods are non-virtual. This may seem a little odd at first, but is consistent: attributes are also not visible to subclasses. By being non-virtual, we also get some other benefits. The latest Rakudo, with its optimizer cranked up to its highest level, optimizes calls to private methods and complains about missing ones at compile time. Thus a typo:&lt;/p&gt;
&lt;pre&gt;    self!compite_subtotal() - self!compute_discount();&lt;/pre&gt;
&lt;p&gt;Will get us a compile time error:&lt;/p&gt;
&lt;pre&gt;    ===SORRY!===
    CHECK FAILED:
    Undefined private method 'compite_subtotal' called (line 18)&lt;/pre&gt;
&lt;p&gt;You may worry a little over the fact that we now can’t subclass the discount computation, but that’s likely not a good design anyway; for one, we’d need to also expose the list of items, breaking our aggregate boundary. If we do want pluggable discount mechanisms we’d probably be better implementing the strategy pattern.&lt;/p&gt;
&lt;p&gt;Private methods can, of course, not be called from outside of the class, which is also a compile time error. First, if you try:&lt;/p&gt;
&lt;pre&gt;    say $order!compute_discount;&lt;/pre&gt;
&lt;p&gt;You’ll be informed:&lt;/p&gt;
&lt;pre&gt;    ===SORRY!===
    Private method call to 'compute_discount' must be fully qualified
    with the package containing the method&lt;/pre&gt;
&lt;p&gt;Which isn’t so surprising, given they are non-virtual. But even if we do:&lt;/p&gt;
&lt;pre&gt;    say $o!Order::compute_discount;&lt;/pre&gt;
&lt;p&gt;Our encapsulation-busting efforts just get us:&lt;/p&gt;
&lt;pre&gt;    ===SORRY!===
    Cannot call private method 'compute_discount' on package Order
    because it does not trust GLOBAL&lt;/pre&gt;
&lt;p&gt;This does, however, hint at the get-out clause for private methods: a class may choose to trust another one (or, indeed, any other package) to be able to call its private methods. Critically, this is the decision of the class itself; if the class declaration didn’t decide to trust you, you’re out of luck. Generally, you won’t need “trusts”, but occasionally you may be in a situation where you have two very closely coupled classes. That’s usually undesirable in itself, though. Don’t trust too readily. :-)&lt;/p&gt;
&lt;p&gt;So, lexical classes, private methods and some nice compiler support to help catch mistakes. Have an agile advent. :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/880/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/880/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/880/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/880/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/880/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/880/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/880/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/880/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/880/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/880/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/880/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/880/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/880/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/880/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=880&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Documenting Perl 6</title>
		<link href="http://perl6advent.wordpress.com/2011/12/10/documenting-perl-6/"/>
		<id>http://perl6advent.wordpress.com/?p=867</id>
		<updated>2011-12-10T18:41:08+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;A wise man once said that programs must be written for people to read, and only incidentally for machines to execute. But aside from being read, your code is also going to be used by people, who don’t really want to dive into it to understand what it does. That’s where the documentation comes in.&lt;/p&gt;
&lt;p&gt;In Perl 5 we had POD, which stands for Plain Old Documentation. In Perl 6 we have Pod, which is not really an abbreviation of anything. As its specification says, “Perl 6′s Pod is much more uniform, somewhat more compact, and considerably more expressive”. It has changed slightly compared to Perl 5 Pod, but most of the stuff remains the same, or at least very similar.&lt;/p&gt;
&lt;p&gt;There are three main types of Pod blocks in Perl 6. &lt;strong&gt;Delimited blocks&lt;/strong&gt; are probably the most obvious and simple ones:&lt;/p&gt;
&lt;pre&gt;    =begin pod&lt;/pre&gt;
&lt;pre&gt;    &amp;lt;whatever Pod content we want&amp;gt;&lt;/pre&gt;
&lt;pre&gt;    =end pod&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Paragraph blocks&lt;/strong&gt; are a bit more magical. They begin with &lt;code&gt;=for&lt;/code&gt;, and end on the nearest blank line (as the name, Paragraph, suggest):&lt;/p&gt;
&lt;pre&gt;    my $piece = 'of perl 6 code'&lt;/pre&gt;
&lt;pre&gt;    =for comment
    Here we put whatever we want.
    The compiler will not notice anyway.&lt;/pre&gt;
&lt;pre&gt;    our $perl6 = 'code continues';&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Abbreviated blocks&lt;/strong&gt; are similar to &lt;strong&gt;Paragraph blocks&lt;/strong&gt;. The leading &lt;code&gt;=&lt;/code&gt; is followed immediately by a Pod block identifier and the content. Sounds familiar?&lt;/p&gt;
&lt;pre&gt;    =head1 Shoulders, Knees and Toes&lt;/pre&gt;
&lt;p&gt;That’s right, &lt;code&gt;=head&lt;/code&gt; is nothing magical in Perl 6 Pod. That means you can write it also as a paragraph block&lt;/p&gt;
&lt;pre&gt;    =for head1
    Longer header
    than we usually write.&lt;/pre&gt;
&lt;p&gt;Or a full-blown delimited block&lt;/p&gt;
&lt;pre&gt;    =begin head1&lt;/pre&gt;
&lt;pre&gt;    This header is longer than it should be&lt;/pre&gt;
&lt;pre&gt;    =end head1&lt;/pre&gt;
&lt;p&gt;Any block can be written as a delimited block, paragraph block, or abbreviated block. No magic. Not all blocks are created equal, of course. &lt;code&gt;=head&lt;/code&gt; will be treated differently than plain &lt;code&gt;=pod&lt;/code&gt;. By whom? By the Pod renderer, of course, but also by the Perl 6 compiler itself. In Perl 6, Pod is not a second-class citizen, ignored during the program compilation. Pod in Perl 6 is a part of the code; along with parsing and constructing AST of the code to be executed, the compiler also parses and builds AST of all Pod blocks. They are then kept in the special &lt;code&gt;$=POD&lt;/code&gt; variable, and can be inspected by the runtime:&lt;/p&gt;
&lt;pre&gt;    =begin pod&lt;/pre&gt;
&lt;pre&gt;    Some pod content&lt;/pre&gt;
&lt;pre&gt;    =end pod&lt;/pre&gt;
&lt;pre&gt;    say $=POD[0].content[0].content;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;say&lt;/code&gt; line may look a little complicated. Content, of a content, of a what? What really happens, is that ‘Some pod content’ is parsed as an ordinary paragraph, and kept in the &lt;code&gt;Pod::Block::Para&lt;/code&gt; object. The delimited block started with &lt;code&gt;=begin pod&lt;/code&gt; becomes a &lt;code&gt;Pod::Block::Named&lt;/code&gt;, and it can contain any number of child blocks. It’s also a first block in our example code, so it ends up in &lt;code&gt;$=POD[0]&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You now probably think “geez, how ugly is that. Who’s going to use it in this form”. Don’t worry. Frankly, I don’t expect anyone to use the AST directly. That’s what Pod renderers are useful for. Take for example &lt;code&gt;Pod::To::Text&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;    =begin pod&lt;/pre&gt;
&lt;pre&gt;    =head1 A Heading!&lt;/pre&gt;
&lt;pre&gt;    A paragraph! With many lines!&lt;/pre&gt;
&lt;pre&gt;        An implicit code block!
        my $a = 5;&lt;/pre&gt;
&lt;pre&gt;    =item A list!
    =item Of various things!&lt;/pre&gt;
&lt;pre&gt;    =end pod&lt;/pre&gt;
&lt;pre&gt;    DOC INIT {
        use Pod::To::Text;
        pod2text($=POD);
    }&lt;/pre&gt;
&lt;p&gt;Ran as it is, the code doesn’t produce any output. Why is it so? The &lt;code&gt;DOC INIT&lt;/code&gt; block looks a little special. It gets run with every other &lt;code&gt;INIT&lt;/code&gt; block, but also only when the &lt;code&gt;--doc&lt;/code&gt; flag is passed to the compiler. Let’s take a look:&lt;/p&gt;
&lt;pre&gt;    $ perl6 --doc foo.pl
    A Heading!

    A paragraph! With many lines!

        An implicit code block!
        my $a = 5;

     * A list!

     * Of various things!&lt;/pre&gt;
&lt;p&gt;Actually, when no &lt;code&gt;DOC INIT&lt;/code&gt; block exists in the code, the compiler generates a default &lt;code&gt;DOC INIT&lt;/code&gt;, identical to the one in the example above. So you could really omit it, leaving only the Pod in the file, and &lt;code&gt;perl6 --doc&lt;/code&gt; will produce exactly the same result.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a name=&quot;but_wait__there_s_more_&quot;&gt;But wait, there’s more!&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I wrote about 3 types of Pod blocks, but there’s another one I didn’t talk about before. They are &lt;strong&gt;Declarator blocks&lt;/strong&gt;, and they single purpose is to document the actual Perl 6 objects. Take a look.&lt;/p&gt;
&lt;pre&gt;    #= it's a sheep! really!
    class Sheep {

        #= produces a funny sound
        method bark {
            say &quot;Actually, I don't think sheeps bark&quot;
        }
    }&lt;/pre&gt;
&lt;p&gt;Every declarator block gets attached to the object which comes after it. It’s available in the &lt;code&gt;.WHY&lt;/code&gt; attribute, so we can use it like this:&lt;/p&gt;
&lt;pre&gt;    say Sheep.WHY.content;                      # it's a sheep! really!
    say Sheep.^find_method('bark').WHY.content; # produces a funny sound&lt;/pre&gt;
&lt;p&gt;In this case we also don’t need to care about doing a &lt;code&gt;^find_method&lt;/code&gt; and all this for every piece of documentation we want to read. The mighty &lt;code&gt;Pod::To::Text&lt;/code&gt; takes care about it too. If we run the Sheep code with &lt;code&gt;--doc&lt;/code&gt; flag, we get the following:&lt;/p&gt;
&lt;pre&gt;    class Sheep: it's a sheep! really!&lt;/pre&gt;
&lt;pre&gt;    method bark: produces a funny sound&lt;/pre&gt;
&lt;p&gt;The specification says it’s possible to document all the class attributes and all the arguments that methods or subroutines take. Unfortunately no Perl 6 implementation (that I know of) implements those yet.&lt;/p&gt;
&lt;p&gt;There are dozens of Pod features that are not covered by this post, for example the formatting codes (&lt;code&gt;&amp;lt;, &lt;/code&gt;&amp;gt; and so), or tables. If you’re interested take a look at Synopsis 26 (&lt;a href=&quot;http://perlcabal.org/syn/S26.html&quot;&gt;http://perlcabal.org/syn/S26.html&lt;/a&gt;). It’s actually written in  Pod 6, and rendered by &lt;code&gt;Pod::To::HTML&lt;/code&gt;. Not all features it describes are implemented yet, but most of them are (see the test suite linked below), and some modules are actually documented with it (&lt;code&gt;Term::ANSIColor&lt;/code&gt; for  example).&lt;/p&gt;
&lt;p&gt;Some useful links:&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;strong&gt;&lt;a class=&quot;item&quot; href=&quot;http://perlcabal.org/syn/S26.html&quot;&gt;&lt;em&gt;Synopsis 26&lt;/em&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/dt&gt;
&lt;dt&gt;&lt;strong&gt;&lt;a class=&quot;item&quot; href=&quot;https://github.com/rakudo/rakudo/blob/nom/lib/Pod/To/Text.pm&quot;&gt;&lt;em&gt;Pod::To::Text source code&lt;/em&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/dt&gt;
&lt;dt&gt;&lt;strong&gt;&lt;a class=&quot;item&quot; href=&quot;https://github.com/tadzik/perl6-Term-ANSIColor/blob/master/lib/Term/ANSIColor.pm#L83&quot;&gt;&lt;em&gt;Term::ANSIColor documentation&lt;/em&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/dt&gt;
&lt;dt&gt;&lt;strong&gt;&lt;a class=&quot;item&quot; href=&quot;https://github.com/rakudo/rakudo/tree/nom/t/pod&quot;&gt;&lt;em&gt;&lt;br /&gt;
Pod test suite (shows what Pod in Rakudo is capable of)&lt;/em&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;p&gt;Happy documenting!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/867/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/867/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/867/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/867/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/867/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/867/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/867/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/867/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/867/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/867/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/867/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/867/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/867/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/867/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=867&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>ttjjss</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 9: Contributing to Perl 6</title>
		<link href="http://perl6advent.wordpress.com/2011/12/09/day-9-contributing-to-perl-6/"/>
		<id>http://perl6advent.wordpress.com/?p=846</id>
		<updated>2011-12-09T14:27:40+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;This time, instead of sharing some cool feature of Perl 6, I’d like to talk about how easy it is to contribute usefully to the project.  So I’m going to walk you through the process of making a change to Niecza.  It does require a bit of domain knowledge (which the fine folks on &lt;code&gt;#perl6&lt;/code&gt; will be happy to help you with) but it’s definitely not rocket science.  It’s not even particularly deep computer science, for the most part.&lt;/p&gt;
&lt;p&gt;A few days ago, Radvendii asked on &lt;code&gt;#perl6&lt;/code&gt; if there was a &lt;code&gt;round&lt;/code&gt; function in the core.  The correct answer is “There should be one”, and it lead to a couple of bug fixes in Rakudo.  But it got me to thinking — is Niecza supporting &lt;code&gt;round&lt;/code&gt; (and its relatives &lt;code&gt;ceiling&lt;/code&gt;, &lt;code&gt;floor&lt;/code&gt;, and &lt;code&gt;truncate&lt;/code&gt;) correctly?&lt;/p&gt;
&lt;p&gt;Perl 6 has a &lt;a href=&quot;https://github.com/perl6/roast&quot;&gt;huge suite of tests&lt;/a&gt; to see if an  implementation is conforming to the spec, including a file for the &lt;code&gt;round&lt;/code&gt; tests, &lt;a href=&quot;https://github.com/perl6/roast/blob/master/S32-num/rounders.t&quot;&gt;&lt;code&gt;S32-num/rounders.t&lt;/code&gt;&lt;/a&gt;.  My first step then was to check the spectests currently being run by Niecza.  Just like in Rakudo, this is stored in a file named &lt;a href=&quot;https://github.com/sorear/niecza/blob/master/t/spectest.data&quot;&gt;&lt;code&gt;t/spectest.data&lt;/code&gt;&lt;/a&gt;.  So&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;Wynne:niecza colomon$ grep round t/spectest.data 
Wynne:niecza colomon$ 
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Okay, clearly we’re not running the &lt;code&gt;S32-num/rounders.t&lt;/code&gt; test file.  (Note, in case you’re getting confused — the links in this post are to the latest versions of the files, which include all the changes I made writing this post.)  That’s a sign that something is not properly supported yet.  So let’s go ahead and run it by hand to see what happens.  Both Niecza and Rakudo use a fudging process, allowing you to mark the bits of a test file that don’t work yet in a particular compiler.  So we need to use a special fudging tool to run the code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;Wynne:niecza colomon$ t/fudgeandrun t/spec/S32-num/rounders.t
1..108
not ok 1 - floor(NaN) is NaN
# /Users/colomon/tools/niecza/t/spec/S32-num/rounders.t line 16
#    Failed test
#           got: -269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That’s followed by about 15 similar errors, then&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;Unhandled exception: Unable to resolve method truncate in class Num
  at /Users/colomon/tools/niecza/t/spec/S32-num/rounders.t line 34 (mainline @ 32) 
  at /Users/colomon/tools/niecza/lib/CORE.setting line 2224 (ANON @ 2) 
  at /Users/colomon/tools/niecza/lib/CORE.setting line 2225 (module-CORE @ 58) 
  at /Users/colomon/tools/niecza/lib/CORE.setting line 2225 (mainline @ 1) 
  at &amp;lt;unknown&amp;gt; line 0 (ExitRunloop @ 0) 
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Okay, so that’s at least two errors that need fixing.&lt;/p&gt;
&lt;p&gt;We’ll go in order here, even though it means tackling what is most likely the most complicated error first.  (If you do think this part of the problem is too hard to tackle, please skip ahead, because the last few improvements I made really were incredibly easy to do.)  Opening &lt;a href=&quot;https://github.com/sorear/niecza/blob/master/lib/CORE.setting&quot;&gt;&lt;code&gt;src/CORE.setting&lt;/code&gt;&lt;/a&gt;, we find the following definition for &lt;code&gt;round&lt;/code&gt;:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;sub round($x, $scale=1) { floor($x / $scale + 0.5) * $scale }
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Okay, so the real problem is in &lt;code&gt;floor&lt;/code&gt;:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;sub floor($x) { Q:CgOp { (floor {$x}) } }
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What the heck does &lt;code&gt;Q:CgOp&lt;/code&gt; mean?  It means &lt;code&gt;floor&lt;/code&gt; is actually implemented in C#.  So we open up &lt;a href=&quot;https://github.com/sorear/niecza/blob/master/lib/Builtins.cs&quot;&gt;&lt;code&gt;lib/Builtins.cs&lt;/code&gt;&lt;/a&gt; and search for &lt;code&gt;floor&lt;/code&gt;, eventually finding &lt;code&gt;public static Variable floor(Variable a1)&lt;/code&gt;.  I won’t print the full source code here, because it is on the long side, with a case for each of the different number types.  We’re only interested in the floating point case here:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;        if (r1 == NR_FLOAT) {
            double v1 = PromoteToFloat(r1, n1);
            ulong bits = (ulong)BitConverter.DoubleToInt64Bits(v1);
            BigInteger big = (bits &amp;amp; ((1UL &amp;lt;&amp;lt; 52) - 1)) + (1UL &amp;lt;&amp;lt; 52);
            int power = ((int)((bits &amp;gt;&amp;gt; 52) &amp;amp; 0x7FF)) - 0x433;
            // note: &amp;gt;&amp;gt;= has flooring semantics for signed values
            if ((bits &amp;amp; (1UL &amp;lt;&amp;lt; 63)) != 0) big = -big;
            if (power &amp;gt; 0) big &amp;lt;&amp;lt;= power;
            else big &amp;gt;&amp;gt;= -power;
            return MakeInt(big);
        }
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;We don’t actually need to understand how all that works to fix this problem.  The important bit is the &lt;code&gt;PromoteToFloat&lt;/code&gt; line, which sets &lt;code&gt;v1&lt;/code&gt; to the floating point value which is the input to our floor.  If we add a trap right after that, it should fix this bug.  A quick C# websearch shows me that &lt;code&gt;Double&lt;/code&gt; has member functions &lt;code&gt;IsNaN&lt;/code&gt;, &lt;code&gt;IsNegativeInfinity&lt;/code&gt;, and &lt;code&gt;IsPositiveInfinity&lt;/code&gt;.  Looking a bit around the Niecza source shows there is a &lt;code&gt;MakeFloat&lt;/code&gt; function for returning floating point values.  Let’s try:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;if (Double.IsNaN(v1) || Double.IsNegativeInfinity(v1) || Double.IsPositiveInfinity(v1)) {
    return MakeFloat(v1);
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;One quick call to &lt;code&gt;make&lt;/code&gt; later, I can try the test file again:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;Wynne:niecza colomon$ t/fudgeandrun t/spec/S32-num/rounders.t
1..108
ok 1 - floor(NaN) is NaN
ok 2 - round(NaN) is NaN
ok 3 - ceiling(NaN) is NaN
not ok 4 - truncate(NaN) is NaN
# /Users/colomon/tools/niecza/t/spec/S32-num/rounders.t line 19
#    Failed test
#           got: -269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824
&lt;/pre&gt;&lt;br /&gt;
Progress!  Apparently truncate uses a separate method, so we’ll have to fix it separately.&lt;br /&gt;
&lt;pre class=&quot;brush: plain;&quot;&gt;sub truncate($x) { $x.Int }
method Int() { Q:CgOp { (coerce_to_int {self}) } }
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: plain;&quot;&gt;    public static Variable coerce_to_int(Variable a1) {
        int small; BigInteger big;
        return GetAsInteger(a1, out small, out big) ?
            MakeInt(big) : MakeInt(small);
    }
&lt;/pre&gt;&lt;br /&gt;
Oooo, this is perhaps a little bit trickier.  Still a basic variant on the previous method, grabbing boilerplate code from a nearby function:&lt;br /&gt;
&lt;pre class=&quot;brush: plain;&quot;&gt;        int r1;
        P6any o1 = a1.Fetch();
        P6any n1 = GetNumber(a1, o1, out r1);

        if (r1 == NR_FLOAT) {
            double v1 = PromoteToFloat(r1, n1);
            if (Double.IsNaN(v1) || Double.IsNegativeInfinity(v1) || Double.IsPositiveInfinity(v1)) {
                return MakeFloat(v1);
            }
        }
&lt;/pre&gt;&lt;br /&gt;
I skipped the &lt;code&gt;HandleSpecial2&lt;/code&gt; bit in the boilerplate, because I’m never quite sure how that works.  Luckily, we have the spectests to check and see if I have broken something by doing this.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now the first 15 tests in &lt;code&gt;rounders.t&lt;/code&gt; pass, leaving us with the&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;Unhandled exception: Unable to resolve method truncate in class Num
&lt;/pre&gt;&lt;br /&gt;
error.  That should be easy to handle!  If we go back to &lt;code&gt;lib/CORE.setting&lt;/code&gt; and search for &lt;code&gt;ceiling&lt;/code&gt;, we see it appears two times: in the catch-all base class &lt;code&gt;Cool&lt;/code&gt; and as a stand-alone sub.  If we look at the neighboring subs, we see &lt;code&gt;floor&lt;/code&gt;, &lt;code&gt;ceiling&lt;/code&gt;, &lt;code&gt;round&lt;/code&gt;, and &lt;code&gt;truncate&lt;/code&gt; are all defined.  If we look in &lt;code&gt;Cool&lt;/code&gt;, however, only &lt;code&gt;floor&lt;/code&gt;, &lt;code&gt;ceiling&lt;/code&gt;, and &lt;code&gt;round&lt;/code&gt; defined.  That’s the source of our trouble!&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The method definitions of the others in &lt;code&gt;Cool&lt;/code&gt; are really simple; all they do is forward to the sub versions.  It’s very easy to add a &lt;code&gt;truncate&lt;/code&gt; that does that:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;    method truncate() { truncate self }
&lt;/pre&gt;&lt;br /&gt;
And poof!  This time when we run &lt;code&gt;rounders.t&lt;/code&gt;, we pass all 108 tests.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;At this point we’ve got three things left to do.  First, now that &lt;code&gt;rounders.t&lt;/code&gt; passes, we need to add it to &lt;code&gt;t/spectest.data&lt;/code&gt;.  The list of tests there is ordered, so I just find the &lt;code&gt;S32-num&lt;/code&gt; section and add &lt;code&gt;S32-num/rounders.t&lt;/code&gt; in alphabetical order.&lt;/p&gt;
&lt;p&gt;Next I will commit all the changes to my copy of the git repo.  (I won’t explain how to do that, there are lots of git tutorials on the web.)  Then I run &lt;code&gt;make spectest&lt;/code&gt; to make sure I haven’t broken anything with these changes.  (Hmm… actually a few TODO passing, bugs elsewhere that this patch has fixed!  Oh, and one test broken, but it’s one which we were only passing by accident before, so I won’t feel bad about fudging it.)  &lt;/p&gt;
&lt;p&gt;Once that is done, you need to send the patch on to the Niecza developers; I believe the easiest way to do this is via github.&lt;/p&gt;
&lt;p&gt;I’ve got one more little change to make that popped into my head while I was working on this.  One naive way of implementing, say &lt;code&gt;floor&lt;/code&gt; would be to convert the input into a floating point value (a Num in Perl 6) and then do &lt;code&gt;Num.floor&lt;/code&gt;.  That doesn’t work for all numbers, however, as most of the other number types are capable of storing numbers larger than will fit in a standing floating point double.  So we probably need tests in the test suite to check for these cases.  Let’s add them.&lt;/p&gt;
&lt;p&gt;The tests in &lt;code&gt;rounders.t&lt;/code&gt; are weirdly organized for my taste.  But hey, we can always add our tests at the bottom.&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;{
    my $big-int = 1234567890123456789012345678903;
    is $big-int.floor, $big-int, &quot;floor passes bigints unchanged&quot;;
    is $big-int.ceiling, $big-int, &quot;ceiling passes bigints unchanged&quot;;
    is $big-int.round, $big-int, &quot;round passes bigints unchanged&quot;;
    is $big-int.truncate, $big-int, &quot;truncate passes bigints unchanged&quot;;
}
&lt;/pre&gt;&lt;br /&gt;
That passes okay in Niecza.  (Probably out of courtesy we should check it on Rakudo as well and fudge it appropriately to make sure we’re not breaking their spectest!)  We need to remember to add the count of new tests to the plan at the top of the test file.  And then we can push that fix to github as well.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In conclusion, contributing to Perl 6 is easy.  Anyone who tries writing Perl 6 code and reports problems they have to &lt;code&gt;#perl6&lt;/code&gt; is helping in a very real way.  If you can write even fairly simple Perl 6 code, then you can write useful spec tests.  It’s only marginally harder to write new methods for the setting in Perl 6.  And even when you have to get down and dirty and start dealing with the language the compiler is implemented in, it’s still quite possible to do useful work without any deep understanding of how the compiler works.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/846/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/846/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/846/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/846/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/846/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/846/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/846/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/846/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/846/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/846/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/846/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/846/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/846/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/846/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=846&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>colomon</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Lexicality and Optimizability</title>
		<link href="http://perl6advent.wordpress.com/2011/12/08/lexicality-and-optimizability/"/>
		<id>http://perl6advent.wordpress.com/?p=859</id>
		<updated>2011-12-08T13:32:17+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Traditional optimizations in compilers rely on compile-time knowledge about the program. Usually statically typed langauges like Java and C are rather good at that, and dynamic languages like Perl 5, ruby and python are not.&lt;/p&gt;
&lt;p&gt;Perl 6 offers the flexibility of dynamic languages, but tries to provide much optimizability nonetheless by &lt;em&gt;gradual typing&lt;/em&gt;, that is offering optional static type annotations.&lt;/p&gt;
&lt;p&gt;But even in the presence of type annotations, another piece is needed for compile time dispatch decision and inlining: the knowledge about the available routines (and in the case of multi subs, the available candidates).&lt;/p&gt;
&lt;p&gt;To provide that knowledge, Perl 6 installs subroutine in lexical scopes (and not packages / symbol tables, as in Perl 5), and lexical scopes are immutable at run time. (Variables inside the lexical scopes are still mutable, you just cannot add or remove entries at run time).&lt;/p&gt;
&lt;p&gt;To provide the necessary flexibility, Perl 6 allows code to run at compile time. A typical way to run code at compile time is with the &lt;code&gt;use&lt;/code&gt; directive:&lt;/p&gt;
&lt;pre&gt; {
    use Test;  # imports routines into the current
               # lexical scope, at compile time
    plan 1;
    ok 1, 'success';
 }
 # plan() and ok() are not available here,
 # outside the scope into which the routines has been imported to.&lt;/pre&gt;
&lt;p&gt;The upside is that a sufficiently smart compiler can complain before runtime about missing routines and dispatches that are bound to fail. Current Rakudo does that, though there are a certainly cases that rakudo does not detect yet, but which are possible to detect.&lt;/p&gt;
&lt;pre&gt; sub f(Int $x) {
          say $x * 2;
           }
 say &quot;got here&quot;;
 f('some string');&lt;/pre&gt;
&lt;p&gt;produces this output with current Rakudo:&lt;/p&gt;
&lt;pre&gt; ===SORRY!===
 CHECK FAILED:
 Calling 'f' will never work with argument types (str) (line 5)
     Expected: :(Int $x)&lt;/pre&gt;
&lt;p&gt;Since built-in routines are provided in an outer scope to the user’s program, all built-in routines are automatically subjected to all the same rules and optimizations as user-provided routines.&lt;/p&gt;
&lt;p&gt;Note that this has other implications: &lt;code&gt;require&lt;/code&gt;, which loads modules at run time, now needs a list of symbols to stub in at compile time, which are later wired up to the symbols loaded from the module.&lt;/p&gt;
&lt;p&gt;The days are past where &quot;a sufficiently smart compiler&quot; was a legend; these days we have a compiler that can provide measurable speed-ups. There is still room for improvements, but we are now seeing the benefits from static knowledge and lexical scoping.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/859/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/859/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/859/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/859/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/859/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/859/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/859/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/859/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/859/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/859/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/859/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/859/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/859/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/859/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=859&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>Moritz</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Adventures in writing a simple grammar profiler</title>
		<link href="http://perl6advent.wordpress.com/2011/12/07/grammarprofiler/"/>
		<id>http://perl6advent.wordpress.com/?p=783</id>
		<updated>2011-12-07T00:00:22+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Inspired by jnthn’s earlier post on &lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/02/grammartracer-and-grammardebugger/&quot; title=&quot;Grammar::Tracer and Grammar::Debugger&quot;&gt;Grammar::Debugger&lt;/a&gt;, I wondered how hard it would be to implement a simple Perl 6 grammar profiler.  Turns out it wasn’t that hard at all.&lt;/p&gt;
&lt;p&gt;As far as profiling goes, all I wanted was counts of how many times each rule was executed and the cumulative time each rule took to execute.    The interface I had in mind was something simple–a multi-level hash with names of grammars at the first level then, at the second level, names of the individual rules within the grammar, and finally the actual timing information.  The timing information would be accessed thusly:&lt;/p&gt;
&lt;pre&gt;say &quot;MyGrammar::MyRule was called &quot; ~ %timing&amp;lt;MyGrammar&amp;gt;&amp;lt;MyRule&amp;gt;&amp;lt;calls&amp;gt; ~ &quot;times&quot;;
say &quot;and took &quot; ~ %timing&amp;lt;MyGrammar&amp;gt;&amp;lt;MyRule&amp;gt;&amp;lt;time&amp;gt; ~ &quot; seconds to execute&quot;;
&lt;/pre&gt;
&lt;p&gt;But first I had to figure out what jnthn’s code was doing.&lt;/p&gt;
&lt;p&gt;From the outside looking in, the basic technique is to replace the normal grammar meta-object with a custom meta-object that inherits most of the behavior of the normal grammar meta-object but replaces the normal method lookup with a custom one that returns a routine that collects the timing information while calling the original method.&lt;/p&gt;
&lt;p&gt;Looking at &lt;a href=&quot;https://github.com/jnthn/grammar-debugger/blob/master/lib/Grammar/Tracer.pm&quot;&gt;jnthn’s code&lt;/a&gt;, I see that if the method name starts with &lt;code&gt;!&lt;/code&gt; or is any one of “parse”, “CREATE”, “Bool”, “defined” or “MATCH”, we just return the original method without modification.  This is so that we don’t trace private methods or accidentally trace methods that aren’t directly part of the grammar but are used by it.  In my simple profiler, I need to get the name of the grammar, which I do by calling &lt;code&gt;my $grammar = $obj.WHAT.perl&lt;/code&gt;. So it looks like I need to add “perl” to that list of methods to pass through unscathed.  Otherwise, I get an infinite recursion.&lt;/p&gt;
&lt;p&gt;Anyway, for those method names that don’t match the aforementioned criteria, we return a custom built routine that accumulates the execution time and increments a counter for the number of calls.  Seems straight-forward enough … below is the code (somewhat untested):&lt;/p&gt;
&lt;pre&gt;my %timing;

my class ProfiledGrammarHOW is Metamodel::GrammarHOW is Mu {

    method find_method($obj, $name) {
        my $meth := callsame;
        substr($name, 0, 1) eq '!' || $name eq any(&amp;lt;parse CREATE Bool defined MATCH perl&amp;gt;) ??
            $meth !!
            -&amp;gt; $c, |$args {
                my $grammar = $obj.WHAT.perl;
                %timing{$grammar} //= {};                   # Vivify grammar hash
                %timing{$grammar}{$meth.name} //= {};       # Vivify method hash
                my %t := %timing{$grammar}{$meth.name};
                my $start = now;                            # get start time
                my $result := $meth($obj, |$args);          # Call original method
                %t&amp;lt;time&amp;gt; += now - $start;             # accumulate execution time
                %t&amp;lt;calls&amp;gt;++;
                $result
            }
    }

    method publish_method_cache($obj) {
        # no caching, so we always hit find_method
    }
}

sub get-timing is export { %timing }
sub reset-timing is export { %timing = {} }

my module EXPORTHOW { }
EXPORTHOW.WHO.&amp;lt;grammar&amp;gt; = ProfiledGrammarHOW;&lt;/pre&gt;
&lt;p&gt;Assuming the above code was saved in file called “GrammarProfiler.pm”, you’d use it by adding the line &lt;code&gt;use GrammarProfiler;&lt;/code&gt; to the top of any program that makes grammar declarations.  Then after you parse your grammar, you can call &lt;code&gt;get-timing()&lt;/code&gt; to obtain the hash that has the timing information for the individual rules that were executed during the parse or &lt;code&gt;reset-timing()&lt;/code&gt; to clear the timing information.&lt;/p&gt;
&lt;p&gt;Of course, a more full-fledged profiler would do much more work and provide many more profiling options, but this isn’t bad for a quick hack and it just might be useful too.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/783/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/783/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/783/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/783/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/783/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/783/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/783/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/783/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/783/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/783/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/783/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/783/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/783/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/783/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=783&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>perlpilot</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Tetris on Niecza</title>
		<link href="http://perl6advent.wordpress.com/2011/12/05/tetris-on-niecza/"/>
		<id>http://perl6advent.wordpress.com/?p=813</id>
		<updated>2011-12-05T23:45:26+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;&lt;a href=&quot;https://github.com/sorear/niecza&quot; title=&quot;Niecza on Github&quot;&gt;Niecza&lt;/a&gt;, the Other Perl 6 Implementation on Mono and .NET, recently gained the ability to call almost any Common Language Runtime library.  In Niecza’s examples directory, a simple 30 line script called gtk1.pl shows how to use gtk-sharp, and thus Gtk and Gdk, the graphical basis of Gnome. Here is gtk1′s central working part:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;my $btn = Button.new(&quot;Hello World&quot;);
$btn.add_Clicked: sub ($obj, $args) { #OK
    # runs when the button is clicked.
    say &quot;Hello World&quot;;
    Application.Quit;
};
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;add_Clicked&lt;/strong&gt; method defines a &lt;span style=&quot;text-decoration: underline;&quot;&gt;callback routine&lt;/span&gt;, essential to process user input. Running gtk1.pl makes the following resizeable button in a window, and it closes when clicked:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.files.wordpress.com/2011/12/helloworld.png&quot;&gt;&lt;img alt=&quot;screen shot of gtk1.pl&quot; class=&quot;aligncenter size-full wp-image-818&quot; src=&quot;http://perl6advent.files.wordpress.com/2011/12/helloworld.png?w=450&quot; title=&quot;gtk1.pl output&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;From gtk1 to Tetris is not far, see the &lt;a href=&quot;https://github.com/sorear/niecza/blob/master/examples/gtk-tetris.pl&quot; title=&quot;Tetris on Niecza source code&quot;&gt;source&lt;/a&gt; also in niecza/examples. Two extra ingredients make it possible: a timer tick callback routine to animate the falling pieces, and non blocking keyboard input to give the user the illusion of control. Add some simple physics and Cairo graphics and you have a playable game (modulo scoring and similar low hanging fruit) in under 170 lines of Perl 6.&lt;/p&gt;
&lt;p&gt;Animation by timer tick works by causing the whole window to be redrawn by an &lt;strong&gt;ExposeEvent&lt;/strong&gt; at regular intervals.  The redraw tries to move the falling piece downwards, and if the physics says no, it adds a new piece at the top instead.  (Bug: that should eventually fail with a full pile of pieces.)  &lt;strong&gt;GLibTimeout&lt;/strong&gt; sets up the timer callback handler which invokes &lt;strong&gt;.QueueDraw&lt;/strong&gt;.  The default interval is 300 milliseconds, and if the game engine wants to speed that up, it can adjust $newInterval which will replace the GLibTimeout on the next tick (sorry about the line wrap):&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;my $oldInterval = 300;
my $newInterval = 300;
...
GLibTimeout.Add($newInterval, &amp;amp;TimeoutEvent);
...
sub TimeoutEvent()
{
    $drawingarea.QueueDraw;
    my $intervalSame = ($newInterval == $oldInterval);
    unless $intervalSame { GLibTimeout.Add($newInterval, &amp;amp;TimeoutEvent); }
    return $intervalSame; # True means continue calling this timeout handler
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks to the excellent way Gtk handles typing, the keystroke event handler is fairly self documenting.  The Piece subroutines do the physics ($colorindex 4 is the square block that does not rotate):&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain;&quot;&gt;$drawingarea.add_KeyPressEvent(&amp;amp;KeyPressEvent);
...
sub KeyPressEvent($sender, $eventargs) #OK not used
{
    given $eventargs.Event.Key {
        when 'Up' { if $colorindex != 4 { TryRotatePiece() } }
        when 'Down' { while CanMovePiece(0,1) {++$pieceY;} }
        when 'Left' { if CanMovePiece(-1,0) {--$pieceX;} }
        when 'Right' { if CanMovePiece( 1,0) {++$pieceX;} }
    }
    return True; # means this keypress is now handled
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;With a bit more glue added, here is the result:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.files.wordpress.com/2011/12/tetris.png&quot;&gt;&lt;img alt=&quot;screen shot of Tetris on Niecza&quot; class=&quot;aligncenter size-full wp-image-825&quot; src=&quot;http://perl6advent.files.wordpress.com/2011/12/tetris.png?w=450&quot; title=&quot;Niecza Perl 6 Gtk Tetris example&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This post has glossed over other details such as the drawing of the graphics, because a later Perl 6 Advent post will cover that, even showing off some beautiful fractals, so keep following this blog!  The above software was &lt;a href=&quot;http://conferences.yapceurope.org/lpw2011/talk/3893&quot; title=&quot;LPW2011 Tetris talk&quot;&gt;presented&lt;/a&gt; at the &lt;a href=&quot;http://conferences.yapceurope.org/lpw2011/&quot; title=&quot;LPW2011&quot;&gt;London Perl Workshop 2011&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/813/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/813/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/813/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/813/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/813/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/813/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/813/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/813/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/813/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/813/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/813/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/813/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/813/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/813/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=813&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>mberends</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">The Flip-Flop operator</title>
		<link href="http://perl6advent.wordpress.com/2011/12/05/the-flip-flop-operator/"/>
		<id>http://perl6advent.wordpress.com/?p=753</id>
		<updated>2011-12-05T07:00:59+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Perl 5 has a binary operator called flip-flop that is false until its first argument evaluates to true and it stays true (flips) until the second argument evaluates to true at which point it becomes false again (flops).  This is such a useful operator that Perl 6 also has flip-flop, only it’s spelled &lt;code&gt;ff&lt;/code&gt; and has a few variants:&lt;/p&gt;
&lt;pre&gt;    ff
    ff^
    ^ff
    ^ff^&lt;/pre&gt;
&lt;p&gt;The circumflex means to skip the end point on that end.&lt;/p&gt;
&lt;p&gt;Perhaps some examples are in order …&lt;/p&gt;
&lt;pre&gt;    for 1..20 { .say if $_ == 9  ff  $_ == 13; }     # 9 10 11 12 13
    for 1..20 { .say if $_ == 9  ff^ $_ == 13; }     # 9 10 11 12
    for 1..20 { .say if $_ == 9 ^ff  $_ == 13; }     #   10 11 12 13
    for 1..20 { .say if $_ == 9 ^ff^ $_ == 13; }     #   10 11 12&lt;/pre&gt;
&lt;p&gt;In each example we’re iterating over the range of numbers from 1 to 20 and output those numbers where the flip-flop returns true. Both the right hand side of the flip-flop (&lt;code&gt;$_ == 9&lt;/code&gt;) and left hand side of the flip-flop (&lt;code&gt;$_ == 13&lt;/code&gt;) are evaluated on each iteration of the loop. (I’ve used simple numeric comparison on both sides of the flip-flop operators here but, in general, any boolean expression could be used.)&lt;/p&gt;
&lt;p&gt;Each instance of the flip-flop operator maintains it’s own little bit of internal state to decide when to return &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt;. All flip-flop operators are born with their internal state set to return &lt;code&gt;False&lt;/code&gt; waiting for the moment they can be flipped and start returning &lt;code&gt;True&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In the first and second examples when &lt;code&gt;$_ == 9&lt;/code&gt;, the flip-flop operators flips their internal state to &lt;code&gt;True&lt;/code&gt; and immediately return &lt;code&gt;True&lt;/code&gt;.  In the third and fourth examples when &lt;code&gt;$_ == 9&lt;/code&gt; the flip-flop operators set their internal state to &lt;code&gt;True&lt;/code&gt; but they return &lt;code&gt;False&lt;/code&gt; on that iteration because of the leading circumflex.&lt;/p&gt;
&lt;p&gt;Similarly, in the first and third examples above, once the RHS evaluates to &lt;code&gt;True&lt;/code&gt;, the flip-flop operators flop their internal state back to &lt;code&gt;False&lt;/code&gt; on next evaluation and return &lt;code&gt;True&lt;/code&gt;. In the third and fourth examples, the flip-flops operators flop sooner by returning &lt;code&gt;False&lt;/code&gt; immediately upon evaluating the RHS &lt;code&gt;True&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To make the flip-flop operator flip, but never flop, use a &lt;code&gt;*&lt;/code&gt; on the RHS:&lt;/p&gt;
&lt;pre&gt;    for 1..20 { .say if $_ == 15 ff *; }     # 15 16 17 18 19 20&lt;/pre&gt;
&lt;p&gt;Perl 6 has another set of flip-flop operators that function similar to the ones mentioned above, except the RHS isn’t evaluted when the LHS becomes true. This is particularly important when both the RHS and the LHS of the flip-flop could evaluate to &lt;code&gt;True&lt;/code&gt; at the same time. These operators are spelled &lt;code&gt;fff&lt;/code&gt;, &lt;code&gt;fff^&lt;/code&gt;, &lt;code&gt;^fff&lt;/code&gt;, and &lt;code&gt;^fff^&lt;/code&gt;.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/753/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/753/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/753/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/753/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/753/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/753/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/753/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/753/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/753/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/753/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/753/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/753/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/753/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/753/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=753&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>perlpilot</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Traits — Meta Data With Character</title>
		<link href="http://perl6advent.wordpress.com/2011/12/04/traits-meta-data-with-character/"/>
		<id>http://perl6advent.wordpress.com/?p=778</id>
		<updated>2011-12-04T07:00:15+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Traits are a nice, extensible way to attach meta data to all sorts of objects in Perl 6.&lt;/p&gt;
&lt;p&gt;An example is the &lt;code&gt;is cached&lt;/code&gt; trait that automatically caches the functions return value, based on the argument(s) passed to it.&lt;/p&gt;
&lt;p&gt;Here is a simple implementation of that trait:&lt;/p&gt;
&lt;pre&gt; # this gets called when 'is cached' is added
 # to a routine
 multi sub trait_mod:&amp;lt;is&amp;gt;(Routine $r, :$cached!) {
     my %cache;
     #wrap the routine in a block that..
     $r.wrap(-&amp;gt; $arg {
         # looks up the argument in the cache
         %cache.exists($arg)
             ?? %cache{$arg}
             # ... and calls the original, if it
             # is not found in the cache
             !! (%cache{$arg} = callwith($arg))
         }
     );
 }

 # example aplication:
 sub fib($x) is cached {
     say(&quot;fib($x)&quot;);
     $x &amp;lt;= 1 ?? 1 !! fib($x - 1) + fib($x - 2);
 }&lt;/pre&gt;
&lt;pre&gt; # only one call for each value from 0 to 10
 say fib(10);&lt;/pre&gt;
&lt;p&gt;A trait is applied with a verb, here &lt;code&gt;is&lt;/code&gt;. That verb appears in the routine name that handles the trait, here &lt;code&gt;trait_mod:&amp;lt;is&amp;gt;&lt;/code&gt;. The arguments to that handler are the object on which the trait is applied, and the name of the trait (here &lt;code&gt;cached&lt;/code&gt;) as a named argument.&lt;/p&gt;
&lt;p&gt;Note that a production grade &lt;code&gt;is cached&lt;/code&gt; would need to handle multiple arguments, and maybe things like limiting the cache size.&lt;/p&gt;
&lt;p&gt;In this example, the &lt;code&gt;.wrap&lt;/code&gt; method is called on the routine, but of course you can do whatever you want. Common applications are mixing roles into the routine or adding them to a dispatch table.&lt;/p&gt;
&lt;p&gt;Traits can not only be applied to routines, but also to parameters, attributes and variables. For example writable accessors are realized with the &lt;code&gt;is rw&lt;/code&gt; trait:&lt;/p&gt;
&lt;pre&gt; class Book {
     has @.pages is rw;
     ...
 }&lt;/pre&gt;
&lt;p&gt;Traits are also used to attach documentation to classes and attributes (stay tuned for an addvent calendar post on Pod6), marking routine parameters as writable and declaring class inheritance and role application.&lt;/p&gt;
&lt;p&gt;This flexibility makes them ideal for writing libraries that make the user code look like a domain-specific language, and supplying meta data in a safe way.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/778/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/778/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/778/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/778/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/778/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/778/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/778/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/778/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/778/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/778/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/778/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/778/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/778/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/778/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=778&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>Moritz</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Buffers and Binary IO</title>
		<link href="http://perl6advent.wordpress.com/2011/12/03/buffers-and-binary-io/"/>
		<id>http://perl6advent.wordpress.com/?p=771</id>
		<updated>2011-12-03T07:30:36+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Perl 5 is known to have very good Unicode support (starting from version 5.8, the later the better), but people still complain that it is hard to use. The most important reason for that is that the programmer needs to keep track of which strings have been decoded, and which are meant to be treated as binary strings. And there is no way to reliably introspect variables to find out if they are binary or text strings.&lt;/p&gt;
&lt;p&gt;In Perl 6, this problem has been addressed by introducing separate types. &lt;code&gt;Str&lt;/code&gt; holds text strings. String literals in Perl 6 are of type &lt;code&gt;Str&lt;/code&gt;. Binary data is stored in &lt;code&gt;Buf&lt;/code&gt; objects. There is no way to confuse the two. Converting back and forth is done with the &lt;code&gt;encode&lt;/code&gt; and &lt;code&gt;decode&lt;/code&gt; methods.&lt;/p&gt;
&lt;pre&gt;    my $buf = Buf.new(0x6d, 0xc3, 0xb8, 0xc3, 0xbe, 0x0a);
    $*OUT.write($buf);

    my $str = $buf.decode('UTF-8');
    print $str;&lt;/pre&gt;
&lt;p&gt;Both of those output operations have the same effect, and print &lt;code&gt;møþ&lt;/code&gt; to the standard output stream, followed by a newline. &lt;code&gt;Buf.new(...)&lt;/code&gt; takes a list of integers between 0 and 255, which are the byte values from which the new byte buffer is constructed. &lt;code&gt;$*OUT.write($buf)&lt;/code&gt; writes the &lt;code&gt;$buf&lt;/code&gt; buffer to standard output.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$buf.decode('UTF-8')&lt;/code&gt; decodes the buffer, and returns a &lt;code&gt;Str&lt;/code&gt; object (or dies if the buffer doesn’t consistute valid UTF-8). The reverse operation is &lt;code&gt;$Buf.encode($encoding)&lt;/code&gt;. A &lt;code&gt;Str&lt;/code&gt; can simply be printed with &lt;code&gt;print&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Of course &lt;code&gt;print&lt;/code&gt; also needs to convert the string to a binary representation somewhere in the process. There is a default encoding for this and other operations, and it is &lt;code&gt;UTF-8&lt;/code&gt;. The Perl 6 specification allows the user to change the default, but no compiler implements that yet.&lt;/p&gt;
&lt;p&gt;For reading, you can use the &lt;code&gt;.read($no-of-bytes)&lt;/code&gt; methods to read a &lt;code&gt;Buf&lt;/code&gt;, and &lt;code&gt;.get&lt;/code&gt; for reading a line as a &lt;code&gt;Str&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; methods are also present on sockets, not just on the ordinary file and stream handles.&lt;/p&gt;
&lt;p&gt;One of the particularly nasty things you can accidentally do in Perl 5 is&lt;br /&gt;
concatenating text and binary strings, or combine them in another way (like with &lt;code&gt;join&lt;/code&gt; or string interpolation). The result of such an operation is a string that happens to be broken, but only if the binary string contains any bytes above 127 — which can be a nightmare to debug.&lt;/p&gt;
&lt;p&gt;In Perl 6, you get &lt;code&gt;Cannot use a Buf as a string&lt;/code&gt; when you try that, avoiding that trap.&lt;/p&gt;
&lt;p&gt;The existing Perl 6 compilers do not yet provide the same level of Unicode support as Perl 5 does, but the bits that are there are much harder to misuse.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/771/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/771/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/771/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/771/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/771/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/771/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/771/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/771/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/771/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/771/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/771/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/771/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/771/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/771/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=771&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>Moritz</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Grammar::Tracer and Grammar::Debugger</title>
		<link href="http://perl6advent.wordpress.com/2011/12/02/grammartracer-and-grammardebugger/"/>
		<id>http://perl6advent.wordpress.com/?p=758</id>
		<updated>2011-12-02T12:37:00+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Grammars are, for many people, one of the most exciting features of Perl 6. They unify parsing with object orientation, with each production rule in your grammar being represented by a method. These methods are a little special: they are declared using the keywords “regex”, “rule” or “token”, each of which gives you different defaults on backtracking and whitespace handling. In common is that they lead to the body of the method being parsed using the Perl 6 rule syntax. Under the hood, however, they really are just methods, and production rules that refer to others are really just method calls.&lt;/p&gt;
&lt;p&gt;Perl 6 grammars also give you a seamless way to combine declarative and imperative parsing. This means efficient mechanisms, such as NFAs and DFAs, may be used to handle the declarative parts – the things that your tokens tend to be made up of – while a more imperative mechanism drives the parsing of larger structures. This in turn means that you don’t need to write a tokenizer; it can be derived from the rules that you write in the grammar.&lt;/p&gt;
&lt;p&gt;So what is the result of parsing some text with a grammar? Well, provided it’s able to match your input, you get back a parse tree. This data structure – made up of Match objects – captures the structure of the input. You can treat each Match node a little bit like a hash, indexing in to it to look at the values that its production rules matched. While you can build up your own tree or other data structure while parsing, sometimes the Match tree you get back by default will be convenient enough to extract the information you need.&lt;/p&gt;
&lt;p&gt;That’s wonderful, but there was a key clause in all of this: “provided it’s able to match”. In the case that the grammar fails to match your input, then it tells you so – by giving back an empty Match object that, in boolean context, is false. It’s at this point that many people stop feeling the wonder of grammars and start feeling the pain of trying to figure out why on earth their seemingly fine grammar did not accept the input they gave it. Often, it’s something silly – but in a grammar of dozens of production rules – or sometimes even just ten – the place where things go wrong can be elusive.&lt;/p&gt;
&lt;p&gt;Thankfully, help is now at hand, in the form of two modules: Grammar::Tracer, which gives you a tree-like trace output of your grammar, and Grammar::Debugger, which gives the same trace output but also enables you to set breakpoints and single step through the grammar.&lt;/p&gt;
&lt;p&gt;A picture is worth a thousand words, so here’s how Grammar::Tracer looks in action!&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.files.wordpress.com/2011/12/gd-1.png&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;alignnone size-full wp-image-759&quot; height=&quot;329&quot; src=&quot;http://perl6advent.files.wordpress.com/2011/12/gd-1.png?w=450&amp;amp;h=329&quot; title=&quot;gd-1&quot; width=&quot;450&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What we’re seeing here is a tree representation of the production rules that were called, starting at “TOP”, next trying to parse a production rule called “country”, which in turn wants to parse a name, two “num”s and an “integer”. The green indicates a successful match, and next to it we see the snippet of text that was captured.&lt;/p&gt;
&lt;p&gt;So what happens when things go wrong? In that case, we see something like this:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.files.wordpress.com/2011/12/gd-2.png&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;alignnone size-full wp-image-760&quot; src=&quot;http://perl6advent.files.wordpress.com/2011/12/gd-2.png?w=450&quot; title=&quot;gd-2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here, we see that something happened during the parse that caused a cascade of failures all the way back up to the “TOP” production rule, which meant that the parse failed overall. Happily, though, we now have a really good clue where to look. Here is the text my grammar was trying to match at the time:&lt;/p&gt;
&lt;pre&gt;Russia
	Ulan Ude : 51.833333,107.600000 : 1
	Moscow : 55.75000,37.616667 : 4&lt;/pre&gt;
&lt;p&gt;Looking at this, we see that the “name” rule appears to have picked up “Ulan”, but actually the place in question is “Ulan Ude”. This leads us directly to the name production in our grammar:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;token name { \w+ }&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Just a smattering of regex fu is enough to spot the problem here: we don’t parse names that happen to have spaces in them. Happily, that’s an easy fix.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;token name { \w+ [\h+ \w+]* }&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;So how do we turn on the tracing? Actually, that’s easy: just take the file containing the grammar you wish to trace, and add at the top:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;use Grammar::Tracer;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;And that’s it; now whenever you use the grammar, it will be traced. Note that this statement has lexical effect, so if you’re using modules that also happen to have grammars – which you likely don’t care about – they will not end up getting the tracing behavior.&lt;/p&gt;
&lt;p&gt;You can also do this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;use Grammar::Debugger;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The debugger is the tracer’s big sister, and knows a few more tricks. Here’s an example of it in action.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.files.wordpress.com/2011/12/gd-3.png&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;alignnone size-full wp-image-761&quot; height=&quot;297&quot; src=&quot;http://perl6advent.files.wordpress.com/2011/12/gd-3.png?w=450&amp;amp;h=297&quot; title=&quot;gd-3&quot; width=&quot;450&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Instead of getting the full trace, now as soon as we hit the TOP production rule the program execution breaks and we get a prompt. Pressing enter allows you to step rule by rule through the parse. For some people, this may be preferable; others prefer to get the full trace output and analyze it. However, there are a few more tricks. In the example above, I added a breakpoint on the “name” rule. Using “r” informs the debugger to keep running through the production rules until it hits one called “name”, at which point it breaks. It is also possible to add breakpoints in code, for more extended debugging sessions with many runs. There’s one additional feature in code, which is to set a conditional breakpoint.&lt;/p&gt;
&lt;p&gt;Sound interesting? You can get modules &lt;a href=&quot;https://github.com/jnthn/grammar-debugger&quot;&gt;from GitHub&lt;/a&gt;, and if you want to see a live demo of a grammar being debugged using it, then there is a &lt;a href=&quot;http://yapc.tv/2011/ye/jonathan-perl6grammars/&quot;&gt;video of my Debugging Perl 6 Grammars talk&lt;/a&gt; from YAPC::Europe 2011; &lt;a href=&quot;http://jnthn.net/papers/2011-yapceu-grammars.pdf&quot;&gt;slides&lt;/a&gt; are also available to make the sample code more clear than it is on the video. Note that the modules need one of the compiler releases from the Rakudo “nom” development branch; we’ll be making a distribution release later this month based on that, though, and these modules will come with it.&lt;/p&gt;
&lt;p&gt;You may also be thinking: I bet these are complex modules doing lots of guts stuff! In fact, they are 44 lines (Grammar::Tracer) and 171 lines (Grammar::Debugger), and written in Perl 6. They are built using the meta-programming support we’ve been working on in the Rakudo Perl 6 compiler during the course of the last year – and if you want to know more about that, be sure to check out my meta-programming post coming up later on in this year’s advent calendar.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/758/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/758/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/758/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/758/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/758/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/758/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/758/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/758/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/758/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/758/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/758/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/758/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/758/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/758/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=758&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>jnthnwrthngtn</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">Macros progress report: a bit of D1</title>
		<link href="http://strangelyconsistent.org/blog/macros-progress-report-a-bit-of-d1"/>
		<id>tag:strangelyconsistent.org,2011-12-01:blog/macros-progress-report-a-bit-of-d1</id>
		<updated>2011-12-01T22:17:28+00:00</updated>
		<content type="html">&lt;p&gt;I've not been making much noise about it, but work on macros is progressing nicely. D1 is about providing a &lt;code&gt;macro&lt;/code&gt; declarator to parallel the &lt;code&gt;sub&lt;/code&gt; declarator, and a &lt;code&gt;quasi&lt;/code&gt; construct which creates ASTs... all of that works already, in &lt;a href=&quot;https://github.com/rakudo/rakudo/tree/macros&quot;&gt;a branch of Rakudo&lt;/a&gt;. Try it out! Be the first one on your block to run macros in Perl 6!&lt;/p&gt;

&lt;p&gt;November has been a busy month for me, &lt;code&gt;$dayjob&lt;/code&gt;-wise. I knew that was going to happen, even though it ended up being even more busy than I had imagined. Now I'm taking a well-deserved two-week vacation, and then I'll be back and actually have some time for Perl 6 hacking. Looking forward to that. 哈哈&lt;/p&gt;

&lt;p&gt;A bit of the part of D1 that doesn't work yet: it turns out that there are &quot;interesting&quot; things happening with lexical lookup and quasiquotes. It's actually nothing very complicated, but it requires some extra wiring. So it's actually possible to cause Null PMC accesses right now because variable lookups from inside of the quasiquote end up confused.&lt;/p&gt;

&lt;p&gt;I know how to solve this, in theory. ASTs have to start carrying around their own lexical environment. But I haven't had time to actually sit down and type out the solution. Will write more when I've done that. Till then, feel free to play around with the parts of macros that don't do too wild lexical lookups.&lt;/p&gt;

&lt;p&gt;Beyond that, I'd like to give D1 a bit of test coverage in roast, and then I think we can merge the D1 work into nom. Looking forward to that.&lt;/p&gt;</content>
		<author>
			<name>Carl Mäsak</name>
			<uri>http://strangelyconsistent.org/blog</uri>
		</author>
		<source>
			<title type="html">Strangely Consistent</title>
			<link rel="self" href="http://strangelyconsistent.org/blog/feed.atom"/>
			<id>http://strangelyconsistent.org/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 1: Catching Up With Perl 6</title>
		<link href="http://perl6advent.wordpress.com/2011/12/01/day-1-catching-up-with-perl-6/"/>
		<id>http://perl6advent.wordpress.com/?p=735</id>
		<updated>2011-12-01T14:40:26+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;When we started the Perl 6 Advent Calendar back in 2009, Rakudo was really the only game in town if you wanted to play with Perl 6. But Perl 6 was intended from the start to be a language with multiple implementations, and at the moment there are four different Perl 6 implementations of interest. Because there are so many implementations, I’m not going to give instructions for getting each; instead I’m linking to those instructions.&lt;/p&gt;
&lt;p&gt;The most stable and complete implementation is &lt;a href=&quot;https://github.com/rakudo/star/downloads&quot;&gt;Rakudo Star&lt;/a&gt;. This is currently based on the &lt;strong&gt;last&lt;/strong&gt; major revision of Rakudo. It’s been frozen since July, and so lags a bit behind the current Perl 6 spec. It’s slow. But it’s also pretty reliable.&lt;/p&gt;
&lt;p&gt;The current Rakudo development version is called &lt;a href=&quot;https://github.com/rakudo/rakudo&quot;&gt;“Nom”&lt;/a&gt;. It’s full of great improvements over the last Rakudo Star release, notably native types, improved performance, and a much better metamodel. (For example, check out the &lt;a href=&quot;https://github.com/jnthn/grammar-debugger/blob/master/lib/Grammar/Tracer.pm&quot;&gt;Grammar::Tracer&lt;/a&gt; module, which takes advantage of the new metamodel to add regex tracing in just 44 lines of code.) It’s not quite ready for prime time yet, as it still misses some features that work in Rakudo Star, but progress has been incredible, and it’s quite possible a new Rakudo Star based on Nom will be released during this month.&lt;/p&gt;
&lt;p&gt;Stefan O’Rear’s &lt;a href=&quot;https://github.com/sorear/niecza&quot;&gt;Niecza&lt;/a&gt; was just a fledging compiler during last year’s Advent calendar, but it’s a serious contender these days. Built to run on the CLR (.NET and Mono), it is relatively zippy, implements a significant portion of Perl 6, and works easily with existing CLR libraries.&lt;/p&gt;
&lt;p&gt;Lastly, ingy and Mäsak have plans afoot to revive &lt;a href=&quot;https://github.com/perl6/Pugs.hs&quot;&gt;Pugs&lt;/a&gt;, the original Perl 6 implementation in Haskell. So far they’ve just got it building again on current Haskell compilers, but the long-term goal is to get it running on the spec tests again and bring it closer to the current spec.&lt;/p&gt;
&lt;p&gt;Which implementation should you use? If you’re looking for a stable, fairly complete Perl 6, Rakudo Star is it. If you just want to explore the language, try Rakudo Nom — you will probably run into bugs, but it’s significantly more advanced than Rakudo Star, and exposing the bugs is a big help to Rakudo’s development. If you have an idea which would benefit from being able to use CLR libraries, Niecza is fantastic. There’s a handy &lt;a href=&quot;http://perl6.org/compilers/features&quot;&gt;comparison chart&lt;/a&gt; of the different features available.&lt;/p&gt;
&lt;p&gt;Personally, I have all three of these installed on my machine, and have different projects underway on each of them.&lt;/p&gt;
&lt;p&gt;Finally, please don’t hesitate to ask for help, either in the comments here or on the &lt;code&gt;#perl6&lt;/code&gt; IRC channel on Freenode. The Perl 6 community is very friendly.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/735/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/735/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/735/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/735/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/735/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/735/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/735/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/735/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/735/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/735/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/735/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/735/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/735/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/735/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=735&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>colomon</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Perl 6 Advent Calendar 2011</title>
		<link href="http://perl6advent.wordpress.com/2011/12/01/perl-6-advent-calendar-2011/"/>
		<id>http://perl6advent.wordpress.com/?p=733</id>
		<updated>2011-12-01T00:19:32+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;For the third year in a row, we are going to post something about Perl 6 every day until Christmas. This post will serve as a table of contents for the entire month.&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/01/day-1-catching-up-with-perl-6/&quot;&gt;Day 1: Catching Up With Perl 6&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/02/grammartracer-and-grammardebugger/&quot;&gt;Day 2: Grammar::Tracer and Grammar::Debugger&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/03/buffers-and-binary-io/&quot;&gt;Day 3: Buffers and Binary IO&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/04/traits-meta-data-with-character/&quot;&gt;Day 4: Traits — Meta Data with Character&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/05/the-flip-flop-operator/&quot;&gt;Day 5: The Flip-Flop operator&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/05/tetris-on-niecza/&quot; title=&quot;Tetris on Niecza&quot;&gt;Day 6: Tetris on Niecza&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/07/grammarprofiler/&quot; title=&quot;Adventures in writing a simple grammar profiler&quot;&gt;Day 7: Adventures in writing a simple grammar profiler&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/08/lexicality-and-optimizability/&quot;&gt;Day 8: Lexicality and Optimizability&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/09/day-9-contributing-to-perl-6/&quot;&gt;Day 9: Contributing to Perl 6&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/733/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/perl6advent.wordpress.com/733/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godelicious/perl6advent.wordpress.com/733/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/delicious/perl6advent.wordpress.com/733/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gofacebook/perl6advent.wordpress.com/733/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/facebook/perl6advent.wordpress.com/733/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gotwitter/perl6advent.wordpress.com/733/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/twitter/perl6advent.wordpress.com/733/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/gostumble/perl6advent.wordpress.com/733/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/stumble/perl6advent.wordpress.com/733/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/godigg/perl6advent.wordpress.com/733/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/digg/perl6advent.wordpress.com/733/&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.wordpress.com/1.0/goreddit/perl6advent.wordpress.com/733/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/reddit/perl6advent.wordpress.com/733/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=perl6advent.wordpress.com&amp;amp;blog=10740073&amp;amp;post=733&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>colomon</name>
			<uri>http://perl6advent.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Perl 6 Advent Calendar</title>
			<subtitle type="html">Something cool about Perl 6 every day</subtitle>
			<link rel="self" href="http://perl6advent.wordpress.com/feed/"/>
			<id>http://perl6advent.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">Announce: Niecza Perl 6 v12 by Stefan O'Rear</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2011/11/msg664.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2011/11/msg664.html</id>
		<updated>2011-11-28T20:56:52+00:00</updated>
		<content type="html">&lt;br /&gt;    Announce: Niecza Perl 6 v12&lt;br /&gt;&lt;br /&gt;This is the twelth release of Niecza Perl 6, as usual scheduled on&lt;br /&gt;the last Monday of the month.  I've not had very much time for Niecza&lt;br /&gt;this month.  This release marks one year since the first public release,&lt;br /&gt;and about a year and a half since the project began.  It's hard to&lt;br /&gt;believe I've been at it this long.&lt;br /&gt;&lt;br /&gt;You can obtain a build of Niecza from [1].  This build contains a&lt;br /&gt;working compiler as a set of .exe and .dll files suitable for use with&lt;br /&gt;Mono or Microsoft .NET.  If you wish to follow latest developments,&lt;br /&gt;you can obtain the source from [2]; however, you will still need a&lt;br /&gt;binary for bootstrapping, so you gain nothing from a &quot;source is&lt;br /&gt;better&quot; perspective.&lt;br /&gt;&lt;br /&gt;Niecza is a Perl 6 compiler project studying questions about the&lt;br /&gt;efficient implementability of Perl 6 features.  It currently targets&lt;br /&gt;the Common Language Runtime; both Mono and Microsoft .NET are known to&lt;br /&gt;work.  On Windows, Cygwin is required for source builds only; see the&lt;br /&gt;README for details.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    List of changes&lt;br /&gt;&lt;br /&gt;[Minor features]&lt;br /&gt;&lt;br /&gt;:BASE&amp;lt;DIGITS&amp;gt; literals are now supported.  (Solomon Foster)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Bug fixes]&lt;br /&gt;&lt;br /&gt;sqrt(-1) is NaN, complex math is strictly opt-in (#64).&lt;br /&gt;&lt;br /&gt;Undefined values can be passed correctly to CLR interop (#66).&lt;br /&gt;&lt;br /&gt;-I is now mentioned by --help (#52).&lt;br /&gt;&lt;br /&gt;Constants, including 'our constant's, are now truly immutable (#46).&lt;br /&gt;&lt;br /&gt;$@ and $^X now properly handled as the last characters in the file (#63).&lt;br /&gt;&lt;br /&gt;Left side of xx is now autothunkified so [] xx 4 works correctly (#70).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Other]&lt;br /&gt;&lt;br /&gt;The internals documentation has been largely rewritten to match the&lt;br /&gt;refactor in v11.&lt;br /&gt;&lt;br /&gt;Added a copy of Martin Berends' London Perl Workshop slides.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Getting involved&lt;br /&gt;&lt;br /&gt;Contact sorear in irc.freenode.net #perl6 or via the sender address of&lt;br /&gt;this mailing.  Also check out the TODO file; whether you want to work&lt;br /&gt;on stuff on it, or have cool ideas to add to it, both are good.&lt;br /&gt;&lt;br /&gt;    Future directions&lt;br /&gt;&lt;br /&gt;My current priorities are:&lt;br /&gt; 1. Make regexes much more feature-complete, including general Unicode&lt;br /&gt;    properties and grapheme mode&lt;br /&gt; 2. Prototype the debugger&lt;br /&gt; 3. 6model convergence work, including roles/native types&lt;br /&gt; 4. Figure out how modules and S11 stuff should work in Niecza.  Do it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[1] https://github.com/downloads/sorear/niecza/niecza-12.zip&lt;br /&gt;[2] https://github.com/sorear/niecza&lt;br /&gt;&lt;br /&gt;</content>
		<author>
			<name>perl6.announce</name>
			<uri>http://www.nntp.perl.org/group/perl.perl6.announce/</uri>
		</author>
		<source>
			<title type="html">perl.perl6.announce</title>
			<subtitle type="html">...</subtitle>
			<link rel="self" href="http://www.nntp.perl.org/rss/perl.perl6.announce.rdf"/>
			<id>http://www.nntp.perl.org/group/perl.perl6.announce/</id>
			<rights type="html">Copyright 1998-2012 perl.org</rights>
		</source>
	</entry>

</feed>

