<?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>2013-05-24T13:04:16+00:00</updated>
	<generator uri="http://www.planetplanet.org/">http://intertwingly.net/code/venus/</generator>

	<entry>
		<title type="html">Parrot 5.4.0 &quot;Austin Parrot&quot; Released! by Bruce Gray</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2013/05/msg694.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2013/05/msg694.html</id>
		<updated>2013-05-22T18:51:15+00:00</updated>
		<content type="html">Jimi Hendrix, deceased, drugs.&lt;br /&gt;    Janis Joplin, deceased, alcohol.&lt;br /&gt;    Mama Cass, deceased, ham sandwich.&lt;br /&gt;        -- Austin Powers (making a list of friends from the Summer of Love)&lt;br /&gt;&lt;br /&gt;On behalf of the Parrot team, I'm proud to announce Parrot 5.4.0, also known&lt;br /&gt;as &quot;Austin Parrot&quot;.  Parrot (http://parrot.org/) is a virtual machine aimed&lt;br /&gt;at running all dynamic languages, and currently focusing on Perl 6.&lt;br /&gt;&lt;br /&gt;Parrot 5.4.0 is available on Parrot's FTP site&lt;br /&gt;(ftp://ftp.parrot.org/pub/parrot/releases/devel/5.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 5.4.0 News:&lt;br /&gt;    - Core&lt;br /&gt;        + Implemented the coth() and acot() math functions.&lt;br /&gt;        + Fixed chomp to only trim a newline when it ends the string. [GH #958]&lt;br /&gt;        + Added readlink() and Parrot_file_readlink(), with tests. [GH #967]&lt;br /&gt;    - Build&lt;br /&gt;        + Parrot now detects the CPU model on Linux systems, as well as&lt;br /&gt;          detecting more CPU models on BSD, Cygwin, Solaris, Win32, and Darwin.&lt;br /&gt;          ARM v7 is also now recognized. [GH #962]&lt;br /&gt;    - Documentation&lt;br /&gt;        + Threads examples now have proper POD sections and useful descriptions&lt;br /&gt;          with links to references.&lt;br /&gt;        + Added main description for Task PMC.&lt;br /&gt;        + Added descriptions to trig methods in Float PMC.&lt;br /&gt;    - Tests&lt;br /&gt;        + Added improved test coverage targets &quot;cover_new&quot; and &quot;fullcover_new&quot;.&lt;br /&gt;        + Improved tests for acot(), coth(), acot() math functions.&lt;br /&gt;        + Added tests for options passed to debugger.&lt;br /&gt;        + Updated native PBC test files for string, number, and integer,&lt;br /&gt;          which resolved 11 TODOs in the test suite. [GH #959]&lt;br /&gt;        + Fixed test for the auto/arch config step.&lt;br /&gt;    - Release process&lt;br /&gt;        + Added message digests to crow.pir.&lt;br /&gt;        + Added in release.json: &quot;release.type&quot; can be &quot;devel&quot; or &quot;supported&quot;.&lt;br /&gt;        + Refactored common code to sub in auto_release.pl.&lt;br /&gt;    - Community&lt;br /&gt;        + Parrot is part of the Hackathon at YAPC::NA::2013, in Austin, TX, USA!&lt;br /&gt;            http://www.yapcna.org/yn2013/wiki?node=Hackathons&lt;br /&gt;        + Parrot has been accepted to Google Summer of Code 2013!&lt;br /&gt;        + Currently there are two high-quality proposals being worked on:&lt;br /&gt;            https://gist.github.com/sa1/5468408        - parrot-libgit2&lt;br /&gt;            https://gist.github.com/denisboyun/5472762 - App::Parrot::Create&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SHA256 message digests for the downloadable tarballs are:&lt;br /&gt;4e37686911b446f5e5f2c0aa62138988ba0c411d2c5e2ba231d1a3421a85ad10 parrot-5.4.0.tar.gz&lt;br /&gt;91d0e46fe3ef08e692e80756f26ee0e7311fe58e49d6c31f3f5180d4eb475696 parrot-5.4.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 18 Jun 2013.&lt;br /&gt;&lt;br /&gt;Enjoy!&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-2013 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes - 2013W20</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W20.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W20.html</id>
		<updated>2013-05-18T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;This week, the most notable change would be Rakudo sort of working on Java Virtual Machine. It still needs lots of improvements, but it can already run “Hello, world” program, what is important milestone in Rakudo for JVM.&lt;/p&gt; id='incompatible_changes'&amp;gt;Incompatible changes&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/specs/commit/1e7aec467b4eb83738513f0bcb6d6ff07e89ec95&quot;&gt;You cannot create a set or bag from list of pairs or hash using a constructor.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;bag {a =&amp;gt; 2}&lt;/code&gt; was ambiguous, because it could mean either &lt;code&gt;bag&lt;/code&gt; containing &lt;code&gt;'a'&lt;/code&gt; with value &lt;code&gt;2&lt;/code&gt;, or &lt;code&gt;bag&lt;/code&gt; containg &lt;code&gt;{a =&amp;gt; 2}&lt;/code&gt; with value &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You’re expected to use &lt;code&gt;.Bag&lt;/code&gt; or &lt;code&gt;.Set&lt;/code&gt; instead, if you mean that.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;stdpm6&quot;&gt;STD.pm6&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/std/commit/e2a36d862079acb91106f89bad8cb03e8279545d&quot;&gt;You cannot use &lt;code&gt;set&lt;/code&gt; or &lt;code&gt;bag&lt;/code&gt; to mean empty set or bag.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you really meant that, you are expected to use &lt;code&gt;set()&lt;/code&gt; or &lt;code&gt;bag()&lt;/code&gt; instead.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;/h2&gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/specs/commit/fd94c282259268cc02bfc46e7a4c52488f34f927&quot;&gt;Slice adverbs support false booleans.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can write code like &lt;code&gt;%a&amp;lt;b&amp;gt; :!exists&lt;/code&gt; to check whatever the element doesn’t exist.&lt;/p&gt;

&lt;p&gt;You can also write code like &lt;code&gt;%a&amp;lt;b&amp;gt; :!delete&lt;/code&gt; which does nothing, but can be used for conditionally deleting hash keys (for example &lt;code&gt;%a&amp;lt;b&amp;gt; :delete(%a&amp;lt;c&amp;gt; :!exists)&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/specs/commit/221b79f028ef77d1e9fec478b3d6933bf476fc9f&quot;&gt;Sets and bags use &lt;code&gt;===&lt;/code&gt; semantics.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Previously the specification hasn’t said which semantics should be used. As anything other than &lt;code&gt;===&lt;/code&gt; semantics would be slow, &lt;code&gt;===&lt;/code&gt; semantics are used.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/specs/commit/14e9ce6c8a7cb5f9f7c69d7c18b8a405031c4b33&quot;&gt;Defined &lt;code&gt;INIT&lt;/code&gt;/&lt;code&gt;END&lt;/code&gt; across modules.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/specs/commit/a7444d895a3641df8ee44311f3613c1612c4de33&quot;&gt;Added &lt;code&gt;FINAL&lt;/code&gt; and &lt;code&gt;COMPOSE&lt;/code&gt; phases.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;FINAL&lt;/code&gt; is ran at link time. &lt;code&gt;COMPOSE&lt;/code&gt; is ran when a role is composed into a class.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;stdpm6&quot;&gt;STD.pm6&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/std/commit/e2a36d862079acb91106f89bad8cb03e8279545d&quot;&gt;&lt;code&gt;set&amp;lt;a b c&amp;gt;&lt;/code&gt; has special error message.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This syntax wasn’t useful for anything, except for perhaps obfuscation. It meant creating empty set, and getting keys &lt;code&gt;'a'&lt;/code&gt;, &lt;code&gt;'b'&lt;/code&gt;, and &lt;code&gt;'c'&lt;/code&gt; from it. As the empty set doesn’t have these keys, it was returning &lt;code&gt;False&lt;/code&gt; 3 times.&lt;/p&gt;

&lt;p&gt;As the behavior doesn’t make any sense, you probably wanted to use &lt;code&gt;set &amp;lt;a b c&amp;gt;&lt;/code&gt; instead. The old behavior is still accessible using &lt;code&gt;set()&amp;lt;a b c&amp;gt;&lt;/code&gt;, but I don’t think you would want to use this.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/std/commit/4dc2553cbf357c3616f7e71d1c7ac2bac145c857&quot;&gt;Perl 5 grammar allows version in &lt;code&gt;require&lt;/code&gt; statement.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In Perl 5, you can write code like &lt;code&gt;require 5.010&lt;/code&gt; do make runtime version check (as opposed to &lt;code&gt;use 5.010&lt;/code&gt; which is compile time check). The Perl 5 grammar, included as part of &lt;code&gt;STD.pm6&lt;/code&gt; now supports this syntax.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/std/commit/9906f18ffb0e0e2cc2b685d56a1febb55ff4e014&quot;&gt;&lt;code&gt;FINAL&lt;/code&gt; and &lt;code&gt;COMPOSE&lt;/code&gt; phases is now recognized.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that these phases are in specification, the grammar was modified to recognize them.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;JVM version of Rakudo supports simplest “Hello, world!” program.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/738531ae8b81805d59ebb79ec46e1f35b40efcf6&quot;&gt;Fixed infinite recursion in &lt;code&gt;IO::Spec::Unix.rel2abs&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rel2abs&lt;/code&gt; made infinite recursion if neither &lt;code&gt;$path&lt;/code&gt; or &lt;code&gt;$base&lt;/code&gt; were absolute.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/a9f3c63d3aa9854ad4e5ab05b0809659db42a0ec&quot;&gt;&lt;code&gt;infix:&amp;lt;~&amp;gt;&lt;/code&gt; is constant folded.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/0d3c9b08fd28214d34f68fb222ae39aad84c16f0&quot;&gt;&lt;code&gt;&amp;lt;prefix:&amp;lt;~&amp;gt;&lt;/code&gt; is constant folded.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/0d3c9b08fd28214d34f68fb222ae39aad84c16f0&quot;&gt;String comparison operators are constant folded.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/0d3c9b08fd28214d34f68fb222ae39aad84c16f0&quot;&gt;String bitwise operators are constant folded.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/b41219e4f001d6029e3bdb6adb69198376f0a085&quot;&gt;&lt;code&gt;defined&lt;/code&gt; is constant folded.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/17085660c99009d2901233812270b4dba246edf4&quot;&gt;&lt;code&gt;Set&lt;/code&gt;, &lt;code&gt;KeySet&lt;/code&gt;, &lt;code&gt;Bag&lt;/code&gt;, and &lt;code&gt;KeyBag&lt;/code&gt; have &lt;code&gt;default&lt;/code&gt; method.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When reading undefined property of those classes, &lt;code&gt;default&lt;/code&gt; method contains value that you should receive. In case of sets, it’s &lt;code&gt;False&lt;/code&gt;. For bags, it’s &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/86cf85a372ddd3e23b4df74b55b6873afa72f318&quot;&gt;Regexpes support more delimiters.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Previously, Rakudo didn’t accept regexpes like &lt;code&gt;m^42^&lt;/code&gt; or &lt;code&gt;m€cash€&lt;/code&gt;. Now, they are allowed, just like in Perl 5.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza&quot;&gt;Niecza&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/sorear/niecza/commit/009f999b8ee82047259955f741685a263c3976a0&quot;&gt;&lt;code&gt;Set&lt;/code&gt;, &lt;code&gt;KeySet&lt;/code&gt;, &lt;code&gt;Bag&lt;/code&gt;, and &lt;code&gt;KeyBag&lt;/code&gt; have &lt;code&gt;default&lt;/code&gt; method.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just like in Rakudo, except with Niecza.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Rakudo on JVM progress update, and some questions answered</title>
		<link href="http://6guts.wordpress.com/2013/05/15/rakudo-on-jvm-progress-update-and-some-questions-answered/"/>
		<id>http://6guts.wordpress.com/?p=273</id>
		<updated>2013-05-14T23:29:33+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;It’s time for another progress update on the ongoing JVM work. Last time I posted here, we’d reached the point of having a self-hosting NQP ready to merge into the master branch of the NQP repository. That has now happened, so the May release of NQP will come with support for running on the JVM (note, this does &lt;strong&gt;not&lt;/strong&gt; mean the May release of Rakudo will come with this level of capability, and a JVM-based Star release with modules is further still!) . In this post, I will discuss some of the things that have happened in the last few weeks and also try to answer some of the questions left behind in the comments last time.&lt;/p&gt;
&lt;h3&gt;The Rakudo Port&lt;/h3&gt;
&lt;p&gt;With NQP pretty well ported (there are some loose ends to tie up, but it’s pretty capable), the currently ongoing step is porting Rakudo. At a high level, Rakudo breaks down into:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The core of the compiler itself: the grammar (for parsing), actions (which assign semantics to the things we parsed), world (which takes care of the declarative aspects of programs), optimizer (tries to cheat without getting caught) and a few other small pieces to support all of this. This is written in NQP.&lt;/li&gt;
&lt;li&gt;The Perl 6 MOP (meta-object protocol) implementation, which defines what classes, roles, enums, subsets and so forth mean. This is also written in NQP.&lt;/li&gt;
&lt;li&gt;The bootstrap, which uses the MOP to piece together various of the core Perl 6 types. It does Just Enough to let us start writing Perl 6 code to define the rest of the built-ins. Also written in NQP.&lt;/li&gt;
&lt;li&gt;The core setting, which is where the built-in types, operators and methods live. This is written in Perl 6.&lt;/li&gt;
&lt;li&gt;A chunk of per-VM code that does lower-level or performance-sensitive things.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first 3 of these need…an NQP compiler. And, it turns out that we have one of those hosted on the JVM these days. But could it handle compiling the Perl 6 grammar? It turns out that, after some portability improvements to the various bits of Perl 6 compiler code, the answer was a resounding “yes”. In fact, the grammar was compiled down to JVM bytecode sufficiently accurately that I didn’t encounter a single parse failure on the entire CORE.setting (though there were lots of other kinds of failures that took a lot of work – more on that in a moment). As for the rest of the compiler code, there were bits of lingering Parrot-specific stuff throughout it, but with a little work they were abstracted away. By far the hardest was BOOTSTRAP, which actually runs a huge BEGIN block to do its setup work and then pokes the results into the EXPORT package. This is kinda neat, as it means the setup work is done once when building Rakudo and then serialized. Anyway, onto the next pieces.&lt;/p&gt;
&lt;p&gt;Compiling the Perl 6 setting depends on the Perl 6 compiler working. Since the first thing the setting does is use the bootstrap, which in turn uses the MOP, it immediately brings all of the above three pieces together. While we talk about “compiling” the setting, there’s a little more to it than that. Thanks to various BEGIN time constructs – such as traits, constant declarations and, of course, BEGIN blocks – all of which show up in the CORE setting – we actually need to run chunks of the code during the compilation process. That’s right – we run bits of the file we’re in the middle of compiling while we’re compiling it. Of course, this will be nothing new to Perl folks – it’s just most Perl programmers probably don’t worry about how on earth you implement this. :-) Thankfully, it’s a solved problem in the NQP compiler toolchain, and the stuff that makes NQP BEGIN blocks work largely handles the Rakudo ones too.&lt;/p&gt;
&lt;p&gt;Anyway, all of this means that even getting the setting to finish the parse/AST phase requires doing enough to run the various traits and so forth. And that in turn brings in the fifth piece: the per-VM runtime support. This includes signature binding, container handling and a few other bits. Thankfully, it no longer involves multiple dispatch, since that is written in NQP these days (apart from some caching infrastructure, which is shared with NQP’s multiple dispatch, and thus was already done). Getting through the parse/AST phase of the setting doesn’t need all of the runtime support to be implemented, but it did require a decent chunk of it. Of course, at the start everything is missing, so getting from line 1 to line 100 was O(week), from 100 to 1000 O(day) and each thousand or so from there O(hour). It’s 13,000 or so lines in all.&lt;/p&gt;
&lt;p&gt;The parse/AST step is just the first (though biggest) phase of compiling Perl 6 code, however. Next comes the optimizer, followed by code generation. In theory, the optimizer could have been bypassed. I planned to do that, then discovered it basically worked for the set of optimizations that didn’t need signature binding to participate in the analysis, so I left it in. Code generation is part of the backend, and so is shared with NQP. So it shoulda just worked, right? Well, yes, apart from code generation is the place where nqp:: ops get resolved to lower level stuff. And Perl 6 uses a lot more of them than NQP. Note that they only have to be mapped to somewhere; the JVM is late bound enough that it won’t complain unless you actually hit the code path that tries to use something that is not yet implemented. In reality I did a bit of both: implementing those that would surely be hit soon or that were trivial, and leaving some others for later.&lt;/p&gt;
&lt;p&gt;So, some time yesterday, I finally got to the point of having a CORE.setting.class. Yup, a JVM bytecode file containing the compiled output of near enough the entire Perl 6 core setting. So, are we done yet? Oh, no way…&lt;/p&gt;
&lt;p&gt;Today’s task was trying to get the CORE setting to load. How hard could that be? Well, it turns out that it does a few tasks at startup, most of which hit upon something that wasn’t in place yet. Typically, it was more of the runtime support, though in some cases it was unimplemented nqp:: ops. Of course, there were a handful of bugs to hunt down in various places to.&lt;/p&gt;
&lt;p&gt;Anyway, finally, this evening, I managed to get the CORE setting to load, at which point, at long last, I could say:&lt;/p&gt;
&lt;pre&gt;perl6 -e &quot;say 'hello world, from the jvm'&quot;
hello world, from the jvm&lt;/pre&gt;
&lt;p&gt;Don’t get too excited just yet. It turns out that many other simple programs will happily explode, due to hitting something missing in the runtime support. There’s still plenty of work to go yet (to give you an idea, trying to say a number explodes, and a for loop hits something not yet implemented), but this is an important milestone.&lt;/p&gt;
&lt;h3&gt;Interop&lt;/h3&gt;
&lt;p&gt;A couple of the comments in response to my last post asked about interop with Java. There’s two directions to consider here: using Java libraries from Perl 6, and using Perl 6 code from Java. Both should be possible, with some marshalling cost, which we’ll no doubt need to spend some time figuring out how to get cheap enough it’s not a problem. It may well be that invokedynamic is a big help here.&lt;/p&gt;
&lt;p&gt;The Java stuff from Perl 6 direction can probably be made fairly convenient to use by virtue of the fact that Perl 6 has a nice, extensible MOP. The fact the object you’re making a call on lives in Java land can be just a detail; we can hide it behind the typical method call syntax, and should even be able to populate a 6model method cache with delegation methods that do the argument mapping. I’m sure there will be plenty of interesting options there. I suspect we’ll want to factor it a little like NativeCall – some lower level stuff in the runtime, and some higher level sugar.&lt;/p&gt;
&lt;p&gt;Going the other way will be more “fun”. I mean, on the one hand the marshalling is just “in the other direction”, which we’d need to do for values coming back from Java land anyway. But trying to work out how to make it feel nice from Java land could be trickier. I don’t believe the “.” operator is very programmable, which probably leaves us with string lookups or code-generated proxy thingies. Or maybe somebody will come up with a Really Great Solution that I hadn’t thought of.&lt;/p&gt;
&lt;p&gt;My JVM related Perl 6 dev focus for now will be getting Rakudo to work decently and start getting Perl 6 modules working on the JVM also, but interop with Java land is certainly on the roadmap of things I think should happen. As with all things, I’m delighted to be beaten to it, but will work on it if it goes undone for too long. :-)&lt;/p&gt;
&lt;h3&gt;Performance?&lt;/h3&gt;
&lt;p&gt;The first thing to say on this is that it’s too early to have a really good idea. The final pieces of the gather/take transform (which has global consequences) have yet to land, which will certainly have some negative impact and will need to happen soon. At the same time, I’ve been very much focused on making things work on the JVM at all over making them especially clever or optimal. Numerous things can be done in ways that will not only perform better in a naive sense, but that will also be much easier for the JVM’s JIT to do clever stuff with. There are many, many things we will be able to do in this area.&lt;/p&gt;
&lt;p&gt;Since I only have a sort-of-working Perl 6 compiler, I can’t say that much about Perl 6 performance. The only result I have to share is that the CORE setting parse completes in around a third of time that it does on Parrot (noting it’s not only about parsing, but also some code generation and running of stuff). This is not especially great – of course, we need to do better than that – but it’s certainly nice that the starting point before I really dig into the performance work is already a good bit faster.&lt;/p&gt;
&lt;p&gt;The other result I have is NQP related. nwc10++ has been doing performance testing with a Levenstein benchmark of each commit to the NQP JVM work, which is really great in so far as it gives me a rough idea if I accidentally regress (or improve ;-)) something performance wise. There, we saw a larger factor performance win, around 15 times faster than the same program running in NQP on Parrot.&lt;/p&gt;
&lt;p&gt;The big negative news on performance is startup time. Part of this is just the nature of the JVM, but I know another enormous part of it is inefficiencies that I can do something about. I’ve plenty of ideas – but again, let’s make things work first.&lt;/p&gt;
&lt;h3&gt;From Here&lt;/h3&gt;
&lt;p&gt;Things will be a little quieter from me over the next week and a bit, due to a busy teaching schedule. But now we have a fledgling Rakudo on JVM, and from here it’s going to be making it gradually more capable, first passing the sanity tests, then moving on to the spectests and the ecosystem. There are ways to help for the adventurous. Some ideas:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Profile the code generation phase, which is one of the pieces that is slower than expected. Try to figure out why.&lt;/li&gt;
&lt;li&gt;Have a look at how multiple dispatch stuff is currently set up, and see if the dispatch logic could possibly be shuffled off behind invokedynamic.&lt;/li&gt;
&lt;li&gt;Try something. See how it explodes. See if you can fix it. (Yes, generic I know. :))&lt;/li&gt;
&lt;li&gt;Have a look at a “make install” target for Rakudo on JVM.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’ll be speaking on the JVM work at the Polish Perl Workshop the weekend after next, and hope to have something a bit more interesting than “hello world” to show off by then.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/273/&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/273/&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=273&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">Perl 6 changes - 2013W19</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W19.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W19.html</id>
		<updated>2013-05-11T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;So, well, what’s new. I’m going to answer - lots of changes and fixes. Even the Niecza, where lately development had slowed down got lots of fixes.&lt;/p&gt; id='incompatible_changes'&amp;gt;Incompatible changes&amp;gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/37c7620bd6a9d45dcc452c4f468770b0bb3b7d62&quot;&gt;Array references aren’t treated as arrays in regular expressions.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Following code used to find 1, 2, or 3.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;my $array = [1, 2, 3];
my $number = prompt 'Give me a number!';
say &quot;It's in array&quot; if $number ~~ / ^ $array $ /;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It doesn’t do that anymore, because variables are expected to be stringified inside regexpes. If you want the old behavior, be explicit and write &lt;code&gt;@$array&lt;/code&gt; instead of &lt;code&gt;$array&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Please note that currently regular expressions are exception to this rule. This is going to be fixed in the future. Lots of code depends on regexpes to be not stringified, and first the warnings will have to be implemented. You are expected to use &lt;code&gt;&amp;lt;$regexp&amp;gt;&lt;/code&gt; instead of &lt;code&gt;$regexp&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/sorear/niecza/commit/20128d7c56282831893e990597cd193ae8787dce&quot;&gt;Changed &lt;code&gt;capitalize&lt;/code&gt; to &lt;code&gt;wordcase&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the current specification, that method is named &lt;code&gt;wordcase&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/sorear/niecza/commit/b1710c17918ec10b4629ce611d8ea58a9e962ccf&quot;&gt;Removed &lt;code&gt;ucfirst&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ucfirst&lt;/code&gt; was long deprecated, and it’s finally time to remove it. You are expected to use &lt;code&gt;tc&lt;/code&gt; instead.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/sorear/niecza/commit/2e98224d3c26fe90b93d97cb42e8bab7b10f527d&quot;&gt;Stringification of &lt;code&gt;Set&lt;/code&gt;, &lt;code&gt;KeySet&lt;/code&gt;, &lt;code&gt;Bag&lt;/code&gt;, and &lt;code&gt;KeyBag&lt;/code&gt; works properly when they are undefined.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Methods &lt;code&gt;Str&lt;/code&gt;, &lt;code&gt;gist&lt;/code&gt; and &lt;code&gt;perl&lt;/code&gt; expected they deal with defined object. This isn’t the case when dealing with the classes themselves.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/sorear/niecza/commit/1d127e411ec6afe968b676aa1505c20d45d2ad1d&quot;&gt;Deprecated &lt;code&gt;$%&lt;/code&gt; and &lt;code&gt;$@&lt;/code&gt; variable checkers are working just like in STD.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;$@(1)&lt;/code&gt; was complaining about use of deprecated variable, when the real problem was use of invalid hard reference syntax.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/1b7852a45c9b47d229f2a4ac0c77536a1306c7a1&quot;&gt;&lt;code&gt;IO::Spec::Win32&lt;/code&gt; no longer warns when using relative pathes.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The check for initial prefix was using optional alternative (&lt;code&gt;([a | b | c])?&lt;/code&gt;). Because of that, it was &lt;code&gt;Nil&lt;/code&gt; if it matched nothing. Since the result of match was stringified just after it was matched, it returned a warning when &lt;code&gt;?&lt;/code&gt; matches nothing. It was fixed to do &lt;code&gt;([a | b | c]?)&lt;/code&gt; instead.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/6e9f45691c8c0a6e2357196484c9a7d26973f68c&quot;&gt;Added tests for &lt;code&gt;IO::Path&lt;/code&gt; and &lt;code&gt;IO::Spec&lt;/code&gt; to list of tests that should pass.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As &lt;code&gt;IO::Path&lt;/code&gt; and &lt;code&gt;IO::Spec&lt;/code&gt; were implemented, their tests are now ran when you request full test from roast test suite.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/2696aab9249fd7cdb83ebaf644c80000cc3a432e&quot;&gt;Interpolation of quotes in regexpes isn’t done twice anymore.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Previously, quotes inside RegExpes were doing interpolation two times.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/2696aab9249fd7cdb83ebaf644c80000cc3a432e&quot;&gt;&lt;code&gt;match&lt;/code&gt; method is fast again.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;https://github.com/rakudo/rakudo/commit/c255f1df the older commits) made it 10 times slower. The performance regression was fixed, and now &lt;code&gt;match&lt;/code&gt; is as fast as it used to be.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/ad71045014a6da4fef5d5c0bff73331cd6a41712&quot;&gt;&lt;code&gt;wordcase&lt;/code&gt; method now accepts &lt;code&gt;where&lt;/code&gt; which is &lt;code&gt;Mu&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Previously, only &lt;code&gt;Any&lt;/code&gt; values were accepted. While using &lt;code&gt;Mu&lt;/code&gt; doesn’t make much sense, there is no reason to disallow it, so it’s allowed now.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/782dec0df77b8d3f0d621de9ed06dd151e630bff&quot;&gt;Configuration instructions don’t say to use –gen-nqp.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was pointless, since &lt;code&gt;--gen-parrot&lt;/code&gt; automatically implied &lt;code&gt;--gen-nqp&lt;/code&gt;. If you want Parrot, it’s safe to assume you want NQP for that Parrot too, right?&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/bfd8508f5ceee565380da201ef25bdfb6feb2b3d&quot;&gt;&lt;code&gt;our&lt;/code&gt; hashes and arrays work.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you had used &lt;code&gt;our @array&lt;/code&gt;, and &lt;code&gt;our %hash&lt;/code&gt;, the object wasn’t initialized properly, and it wasn’t working like array or hash. This made &lt;code&gt;our&lt;/code&gt; work only with &lt;code&gt;$scalar&lt;/code&gt;s previously.&lt;/p&gt;

&lt;p&gt;Previously, trying to use &lt;code&gt;our&lt;/code&gt; with arrays or hashes caused strange uninitialized variable to appear. It didn’t have &lt;code&gt;STORE&lt;/code&gt; method, so you couldn’t have put anything in this variable, and had &lt;code&gt;Any&lt;/code&gt; instead of empty array of hash.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/b1695cf3bb9ef32225d5862551253897f0667634&quot;&gt;It’s now possible to augment empty list.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;MONKEY_TYPING&lt;/code&gt; couldn’t be used to modify lists. Now it can.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/sorear/niecza/commit/31f36d2a2fb76e6c819670860e2d892b25d9a397&quot;&gt;&lt;code&gt;Pair.perl&lt;/code&gt; can now deal with the cases when &lt;code&gt;Pair&lt;/code&gt; is the key.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Doing &lt;code&gt;((a =&amp;gt; 'b') =&amp;gt; 'c').perl&lt;/code&gt; used to output &lt;code&gt;&quot;a&quot; =&amp;gt; &quot;b&quot; =&amp;gt; &quot;c&quot;&lt;/code&gt;, what actually meant &lt;code&gt;(a =&amp;gt; (b =&amp;gt; 'c'))&lt;/code&gt;. &lt;code&gt;.perl&lt;/code&gt; now outputs correct code in that case.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/sorear/niecza/commit/69a3432d221934d6719ddbb4316d51f924af9149&quot;&gt;Implemented Hash.ACCEPTS.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">After the #masakism workshop</title>
		<link href="http://strangelyconsistent.org/blog/after-the-masakism-workshop"/>
		<id>tag:strangelyconsistent.org,2013-05-05:blog/after-the-masakism-workshop</id>
		<updated>2013-05-05T21:22:45+00:00</updated>
		<content type="html">&lt;p&gt;On May 1st I learned what happens if you tell a bunch of people on the
Internet, not all of whom you've met before, that you're going to teach Perl (5
and 6) for free on an IRC channel for four hours.&lt;/p&gt;

&lt;p&gt;It worked well. Actually, it worked well beyond my expectations.&lt;/p&gt;

&lt;h2&gt;Successes&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prepare.&lt;/strong&gt; I had written a bunch of material; short-ish texts mixed with
exercises. I didn't hear any feedback about the texts, but people threw
themselves on the exercises. Which was lucky, because I basically didn't
have time to interact much with people. Everyone did their own thing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Map.&lt;/strong&gt; The week before the workshop, I was taking a walk, and it occurred
to me that the topics for the workshop should be laid out on a &lt;em&gt;subway map&lt;/em&gt;.
That turned out to work unexpectedly well. People followed the structure,
I think. The material was pretty clear that they were free to skip/jump
around if they wanted, so some did that.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Github.&lt;/strong&gt; People suggested fixes and improvements to the material during
the workshop. I handled the easy ones, and delegated what could be delegated.
If anything about the workshop felt 2013-futuristic, it was the fact that
participants were hacking on the workshop &lt;em&gt;in real time&lt;/em&gt;, as it was being
played out. Github was totally right for this.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;tadzik++ did an exercise and got a solution that I didn't expect. We
agreed that a test was missing to force people to do the right thing,
so he went ahead and added it.&lt;/li&gt;
&lt;li&gt;LlamaRider++ added hyperlinks between all the files.&lt;/li&gt;
&lt;li&gt;grtodd++ made the subway map clickable.&lt;/li&gt;
&lt;li&gt;choroba++ added hyperlinks to a file that I added later.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Things learned&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Newbies.&lt;/strong&gt; This was never a workshop for total beginners. Still, we got
a number of those. I'm not sure how many. If there's a next time, I'll
want to add a track for the people who haven't done Perl before.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Exercises.&lt;/strong&gt; Based on the tasks that people &lt;a href=&quot;https://gist.github.com/masak/5496294&quot;&gt;actually
solved&lt;/a&gt;, I got a
lot of feedback on what worked and what didn't. Which exercises served the
overall message of the course, and which ones didn't.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Message.&lt;/strong&gt; After the workshop, I know much better what I &lt;em&gt;wanted&lt;/em&gt; the
whole thing to be about. I think I can go back and make that even more
clear. I'm still surprised at how well it worked already the first time
around... but some bits in there can certainly be improved.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Message&lt;/h2&gt;

&lt;p&gt;So... what was the real message of the workshop? What is &quot;masakism&quot;?&lt;/p&gt;

&lt;p&gt;Two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Testing gets you far.&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;My pain threshold for writing things without tests is half a screen of
code. If I have more than that, there's probably something I should
be writing tests for.&lt;/li&gt;
&lt;li&gt;That said, there's no need to be a fundamentalist about anything. I'm
just saying that tests are good, and still somewhat undervalued
sometimes. But it's always a question on spending time testing the
stuff that matters. Of course.&lt;/li&gt;
&lt;li&gt;Even with tests, there's no substitute for knowing what you're doing
and where you're going. Tests help a lot, but they don't write the
program for you.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keep it small and simple.&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&quot;Inside every big interesting problem is a small interesting problem,
struggling to get out.&quot;&lt;/li&gt;
&lt;li&gt;The realization that you can write objects that focus &lt;em&gt;entirely&lt;/em&gt; on
your core problem, is a strong one.&lt;/li&gt;
&lt;li&gt;People tend to bring in persistence too early, &quot;polluting&quot; their core
classes with database code. Hindering testability. This is backwards.&lt;/li&gt;
&lt;li&gt;Your program should be like an onion, with the most precious stuff
in the middle, and layers around that. Outer layers should point to
inner layers, but not vice versa.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Once more?&lt;/h2&gt;

&lt;p&gt;So, should we do another &lt;code&gt;#masakism&lt;/code&gt; workshop?&lt;/p&gt;

&lt;p&gt;Yes, maybe we should. People seemed to like this first one. I'm open to finding
a datetime for another one.&lt;/p&gt;

&lt;p&gt;If you have any suggestions, get in touch.&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">Perl 6 changes - 2013W18</title>
		<link href="http://glitchmr.github.com/perl-changes-2013W18.html"/>
		<id>http://glitchmr.github.com/perl-changes-2013W18.html</id>
		<updated>2013-05-04T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Perl 6 gets more and more stable, less features are added, and the features that are left are worked on. Also, Rakudo Perl is being ported to JVM.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/specs/commit/3acfeda8111674b72752bba03c9cbe02ded4c408&quot;&gt;Updated IO:: classes documentation pages.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To many minor changes to describe, just follow the link.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/specs/commit/2a92e084f167d7a76568b6c7aaffff6da572b140&quot;&gt;Added &lt;code&gt;IO::Spec&lt;/code&gt;, &lt;code&gt;IO::Path.cleanup&lt;/code&gt;, and &lt;code&gt;IO::Path.resolve&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/specs/commit/6e2d9c944ca5b50cef9e23b15f130a626c1c2b9e&quot;&gt;Flip flops now use smartmatch semantics instead of boolean semantics.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you can write code like &lt;code&gt;&quot;BEGIN&quot; ff &quot;END&quot;&lt;/code&gt;, instead of using regexes for that.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;stdpm6&quot;&gt;STD.pm6&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/std/commit/fa59c1b325a54b632447c1bcdb01a0e68b6bc0bd&quot;&gt;Use of &amp;amp; in infix position is now catched after whitespace.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Previously, code like &lt;code&gt;$some-object.some-method &amp;amp;sub-routine&lt;/code&gt; appeared to work. However, it didn’t meant what you would expect, it didn’t called the method with subroutine argument, but assumed junction and. In order to avoid surprises, this is now disallowed.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/std/commit/276a42f6c9602d25cd87518b0238876b6bce2f04&quot;&gt;The message about no parens or colon after method name is more specific.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now code like &lt;code&gt;$some-object.some-method 42&lt;/code&gt; shows information that colon or parens are required.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/std/commit/291c7f08bd966544264332bb7c64f619f3a5cdca&quot;&gt;Added lots of function declarations.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The STD now recognizes certain functions that were added lately.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;is-prime&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;expmod&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;mkdir&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;rmdir&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;socket&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;listen&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;accept&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;connect&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;bind&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;infix:&amp;lt;leg&amp;gt;&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;infix:&amp;lt;cmp&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/perl6/std/commit/b33d8e0b99931d59e6fe4fed81f6c05443ab9e68&quot;&gt;Added &lt;code&gt;LoL&lt;/code&gt; class and &lt;code&gt;X&lt;/code&gt; role.&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/5b53365d8b774f94ccf371107e5c1544574bddcf&quot;&gt;Implemented &lt;code&gt;IO::Spec&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This class is intended to do OS-specific manipulation of pathes. It can get the localizations of special folders (for example home directory, root directory, temponary directory), and can manipulate pathes (by joining them, spliting them, converting them to absolute or relative, and so on).&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/22397c5677aa89a0dbdb631aab98454049a41a6f&quot;&gt;Implemented &lt;code&gt;IO::Path::&amp;lt;os subclasses&amp;gt;&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks to this change, the pathes objects are OS specific. You can have path marked to be Windows path, so you can parse it in OS specific way, without having to use that OS.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/08b640344cfd2de9a44afc313959a75c6568bcc5&quot;&gt;Repeated &lt;code&gt;shift&lt;/code&gt; is faster.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On large arrays, &lt;code&gt;shift&lt;/code&gt; is now noticeably faster. For example, if array &lt;code&gt;@a&lt;/code&gt; has &lt;code&gt;50_000&lt;/code&gt; elements, running following snippet of code is processed within 2.5 seconds (and not 9.0 seconds).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@a.shift while @a;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/5edb1357bec9418a9b45d78c85290b59e3e0f821&quot;&gt;Failed regex matches now return &lt;code&gt;Nil&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Previously, failed regex matches were returning the &lt;code&gt;Match&lt;/code&gt; object that stringified to &lt;code&gt;#&amp;lt;failed match&amp;gt;&lt;/code&gt; and was converted to &lt;code&gt;False&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/80257434650c3fd8059df2d39916eee96f2dd19b&quot;&gt;&lt;code&gt;&amp;amp;diag&lt;/code&gt; function in &lt;code&gt;Test.pm&lt;/code&gt; accepts &lt;code&gt;Mu&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This, I think is self explanatory. &lt;code&gt;&amp;amp;diag&lt;/code&gt; is a debugging function, outputing its argument. Forbidding &lt;code&gt;Mu&lt;/code&gt; didn’t made sense, so it’s now allowed.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/c66c428cee75dcc28dcdf5140d6903105392d9d6&quot;&gt;Exporting of subroutines now works properly.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;use Module qw(sub1 sub2)&lt;/code&gt; should now work.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rakudo/rakudo/commit/02c7fbb8d716e9f1b8eb664d1340fc4b378858eb&quot;&gt;Fixed &lt;code&gt;dir()&lt;/code&gt; to work on Windows.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This makes &lt;code&gt;panda&lt;/code&gt; work on Windows.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en-us">To merge or not to merge?</title>
		<link href="http://szabgab.com/to-merge-or-not-to-merge.html"/>
		<id>http://szabgab.com/to-merge-or-not-to-merge.html</id>
		<updated>2013-04-28T18:04:29+00:00</updated>
		<content type="html">I have a problem:

Should I keep the 3 Perl Maven sites (
&lt;a href=&quot;http://perl5maven.com/&quot;&gt;Perl 5 Maven&lt;/a&gt;, 
&lt;a href=&quot;http://perl6maven.com/&quot;&gt;Perl 6 Maven&lt;/a&gt;, and
&lt;a href=&quot;http://perlmaven.com/&quot;&gt;Perl Maven&lt;/a&gt;) separate,
or should I merge them together?

Or maybe I should merge P5M into PM and leave P6M separate.


&lt;p&gt;For the full article visit &lt;a href=&quot;http://szabgab.com/to-merge-or-not-to-merge.html&quot;&gt;To merge or not to merge?&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Gabor Szabo</name>
			<uri>http://szabgab.com</uri>
		</author>
		<source>
			<title type="html">Gabor Szabo Perl trainer and developer</title>
			<subtitle type="html">Gabor Szabo about programming in Perl, automated testing, dynamic languages and everyting else</subtitle>
			<link rel="self" href="http://szabgab.com/blog/Perl%206.rss"/>
			<id>http://szabgab.com</id>
			<rights type="html">Copyright 2002-2013, Gabor Szabo</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes - 2013W17</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W17.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W17.html</id>
		<updated>2013-04-27T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Continuing, still with commit IDs.&lt;/p&gt; id='incompatible_changes'&amp;gt;Incompatible changes&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DateTime&lt;/code&gt; doesn’t accept &lt;code&gt;Callable&lt;/code&gt; timezones anymore. &lt;a href=&quot;https://github.com/perl6/specs/commit/5692ced333&quot;&gt;5692ced333&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Renamed &lt;code&gt;IO&lt;/code&gt; to &lt;code&gt;IO::Handle&lt;/code&gt;. &lt;code&gt;IO&lt;/code&gt; itself is a role. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/2dca6ed950&quot;&gt;2dca6ed950&lt;/a&gt; &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/37c9956502&quot;&gt;37c9956502&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;DateTime&lt;/code&gt; doesn’t accept &lt;code&gt;Callable&lt;/code&gt; timezones anymore. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/71ea142406&quot;&gt;71ea142406&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Implemented &lt;code&gt;Cool.lines&lt;/code&gt;. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/0d1d1194a4&quot;&gt;0d1d1194a4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">t2: Rectangle haikus</title>
		<link href="http://strangelyconsistent.org/blog/t2-rectangle-haikus"/>
		<id>tag:strangelyconsistent.org,2013-04-25:blog/t2-rectangle-haikus</id>
		<updated>2013-04-25T20:50:50+00:00</updated>
		<content type="html">&lt;div style=&quot;background: #ded; margin: 1em; padding: 1em;&quot;&gt;&lt;code&gt;sheep hide at bad rains&lt;br /&gt;
bitterly modest slumber&lt;br /&gt;
its star to their rains&lt;br /&gt;
     -- generated by one of the t2 solutions&lt;/code&gt;&lt;/div&gt;

&lt;p&gt;How time flies. It's two months since I reviewed the first batch of
&lt;a href=&quot;http://github.com/masak/p6cc2012#readme&quot;&gt;p6cc&lt;/a&gt; solutions. I solemnly swear the
next blog post will appear sooner than that.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;## Generate rectangle haikus

Write a program that generates haikus. A haiku has three lines, where the first
and last lines have five syllables each, and the middle line has seven. For the
purpose of this exercise, each line consists only of letters and spaces.

The haikus generated have the additional requirement that each line be of equal
length. The length requirement should not be gamed in any way, for example by
padding lines with spaces.

    since this one does it
    rectangle plus a haiku
    it serves as fine text

The program should attempt to generate a new haiku each time. The haiku should
consist of English words. If the words make sense in some kind of sentence
structure, that's considered a big bonus. Humor and/or deeper meanings are even
bonuser.

If you attempt to cheat at this task, you will be defeated by people who don't.

You're free to supply your own wordlist. How you count syllables is up to you,
and part of the task. You won't be challenged on trivial differences in
syllable counts.

It's OK for the program to run for a while, but it should preferably terminate
within a reasonable span of time.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I warmly recommend people to check out &lt;a href=&quot;https://github.com/masak/p6cc2012/tree/master/t2/review&quot;&gt;the
solutions&lt;/a&gt; to this one. People are all over the place, coming up with ways to generate a rectangular haiku.&lt;/p&gt;

&lt;p&gt;Some patterns recur, though. Let's break things down into subtasks and discuss
them separately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Word lists&lt;/strong&gt;. Some contestants had their wordlists inlined in the code.
Others had it in a separate file. Some stored part-of-speech information
together with the word, or syllable count.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sentence structure&lt;/strong&gt;. Solutions are all across the spectrum, all the way from
&quot;just spew words&quot;, via &quot;generate something that could perhaps pass for a
sentence&quot;, all the way to &quot;try really hard to be grammatical&quot;. In my view, being
more high-end on this bit pays off big in quality. But it also costs in code
complexity and program speed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Search&lt;/strong&gt;. This is a biggie, because it bleads through into the whole design of
the program. Some of the solutions simply brute-force it. Others generate stuff
randomly but store things in a hash table, guaranteeing that eventually some
triplet of lines will form a haiku of some length. Some algorithms do clever
things here, like turning problems around, going from &quot;how many syllables does
this line have?&quot; to &quot;ok, give me a word with this many syllables&quot;. One solution
partitions the integers 5 and 7 in all possible ways, and hard-codes the
resulting table.&lt;/p&gt;

&lt;p&gt;But the really interesting bit in all solutions is the syllable counting. This
is where the participants really differ in approach. One went with porting the
CPAN module for counting syllables. Someone else did the same, but put the
module on modules.perl6.org for everyone to use. Two contestants seem to have
come up with their own (flawed) syllable-counter. A few people evade the
syllable-counting by just storing the values along with the word lists. (Which
is fine.)&lt;/p&gt;

&lt;p&gt;All in all, an interesting set of solutions to a fun problem. Somehow, after
reviewing all of these, I have the distinct feeling that a &quot;best&quot; solution
could be put together by combining the best bits of everyone's solutions. I
might just do that myself, if no-one beats me to it.&lt;/p&gt;

&lt;p&gt;Next up: arranging wire crossings to rearrange wires!&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 #masakism workshop</title>
		<link href="http://strangelyconsistent.org/blog/the-masakism-workshop"/>
		<id>tag:strangelyconsistent.org,2013-04-24:blog/the-masakism-workshop</id>
		<updated>2013-04-24T22:37:50+00:00</updated>
		<content type="html">&lt;p&gt;So, as part of my &lt;code&gt;$dayjob&lt;/code&gt;, I was teaching a Perl course. Then this happened:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;* masak is teaching Perl 5 today! :)
&amp;lt;Heather&amp;gt; masak teach me
&amp;lt;masak&amp;gt; Heather: later; these people are paying me. :P
[...]
&amp;lt;masak&amp;gt; seriously though; if there were enough interest here on IRC, I
        would totally do a 1-day Perl 5 IRC workshop, pro bono.
&amp;lt;masak&amp;gt; ditto a one-day Perl 6 IRC workshop.
&amp;lt;vaelxon&amp;gt; (Perl 6 IRC workshop)++
&amp;lt;masak&amp;gt; it'd be very awesome, I promise. I'd need some time to prepare.
        but then we can grab a channel and basically party/learn for a
        day together.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And that's now what's happening. It'll be a loose-knit group of us, joining up
in the &lt;code&gt;#masakism&lt;/code&gt; IRC channel for four hours on May 1.&lt;/p&gt;

&lt;p&gt;The course will be two-pronged; Perl 5 or Perl 6, whatever people prefer.&lt;/p&gt;

&lt;p&gt;There will be prepared study material and exercises, but basically, people who
participate can go off on a tangent, just spend the four hours solving one of
the exercises really well, or solving a &lt;em&gt;different&lt;/em&gt; exercise that they make up
themselves. People can focus on doing the exercises, or on discussing various
ways to solve them, or on discussing general principles of programming. Think
of the workshop as a hybrid of people writing/showing nice code, and people
discussing programming best practices.&lt;/p&gt;

&lt;p&gt;Why am I doing this? Because as part of teaching Perl courses for &lt;code&gt;$dayjob&lt;/code&gt;, I
realized how much I &lt;em&gt;love&lt;/em&gt; teaching Perl. I literally spend those two course
days teaching Perl in a mild state of euphoria. I teach a lot of other courses,
and some of them are great to teach, but none of them are like Perl. I think
it's because I feel at home in the language, my brain has somehow &quot;shaped
itself&quot; around Perl, and the questions I get can often be answered with a
happy &quot;let's find out!&quot; where (a) we do some quick experiment in a terminal
window, and (b) I tend to know what we'll get before, so it's easy to explain.&lt;/p&gt;

&lt;p&gt;The whipuptitude of Perl really works to one's advantage there. That, combined
with knowing my way around most of the &lt;code&gt;perldoc&lt;/code&gt; pages and most of the special
variables. Oh, and I probably have a slight advantage being fairly deeply
involved in Perl 6 stuff, too.&lt;/p&gt;

&lt;p&gt;Anyway, I absolutely love teaching Perl. Five and six. So much so that I'd
do it for free. So this is me doing it for free.&lt;/p&gt;

&lt;p&gt;As I write this, there are 13 participants signed up for the course. This is
already twice as big as the typical Perl course I teach in a corporate setting.
It's also a wide range of people; from relative newbies to people who could
probably give the workshop better than me. I expect people further up on the
learning curve to step in and assist with people further down. But I hardly
need to say that; this is Perl, and we're a helpful bunch.&lt;/p&gt;

&lt;p&gt;Here's &lt;a href=&quot;https://gist.github.com/masak/5431185&quot;&gt;more info about the workshop&lt;/a&gt;,
including when, where, what, and how to sign up.&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">Perl 6 changes - 2013W16</title>
		<link href="http://glitchmr.github.com/-perl-6-changes-2013W16.html"/>
		<id>http://glitchmr.github.com/-perl-6-changes-2013W16.html</id>
		<updated>2013-04-20T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;It’s sixteen article in the series. The game goes so fast, and I still haven’t done pagination on my website (lazy as always). The scrollbar is still shorter (1 pixel on my PC) than on Planet Six, but most likely because of longer lines.&lt;/p&gt;&lt;p&gt;NQP was bootstrapped on JVM. That means it can compile itself. It still doesn’t support Perl 6 perfectly, because some code still uses &lt;code&gt;pir::&lt;/code&gt;, but it progressed really far. Also, the new version of Rakudo Perl, 2013.04 “Albany” was released. Every improvement mentioned here, is in.&lt;/p&gt;&lt;p&gt;I’ve decided to experiment with commit links this time. This way, you can click (or press, or whatever, depends on your device, to get code of this change).&lt;/p&gt; id='potentially_incompatible_changes'&amp;gt;Potentially incompatible changes&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;Removed &lt;code&gt;IO::Dir&lt;/code&gt; and &lt;code&gt;IO::File&lt;/code&gt; classes. &lt;a href=&quot;https://github.com/perl6/specs/commit/fb25fa47585436c8f1d9e227f86e3de537e62cb1&quot;&gt;fb25fa475854&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IO::Path&lt;/code&gt; is closer to actual spec. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/24532aca13377bad63c57e428bb2a4c36ecf536f&quot;&gt;24532aca13&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Added &lt;code&gt;Bool&lt;/code&gt; method to &lt;code&gt;Capture&lt;/code&gt;. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/9f873d89e3538e8cc8c9c41cbc9abd6f78e6499b&quot;&gt;9f873d89e3&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;List.ACCEPTS&lt;/code&gt; now has special &lt;code&gt;Whatever&lt;/code&gt; handling. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/f17d339185c95e4b3b17230cb9b93032578e2a53&quot;&gt;f17d339185&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;do...for&lt;/code&gt; doesn’t propose &lt;code&gt;repeat...for&lt;/code&gt; now. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/41a92e808ebc8d70eda169f549f9ece869019708&quot;&gt;41a92e808e&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Documented build memory requirements (1GB of memory). &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/4109be8905860adf8369b51808c8e9d93970dfca&quot;&gt;4109be8905&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;require PATH|$variable|Module:file(PATH)&lt;/code&gt; syntaxes are now accepted. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/c946d0f7f715a8420917e518b9d7cad608519062&quot;&gt;c946d0f7f7&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Removed reporting variable name for uninitialized variable warnings because it was producing too many false positives. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/c39b887388d85c70e0a2a17de8cdacf751461c7d&quot;&gt;c39b887388&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Replaced more &lt;code&gt;pir::&lt;/code&gt; to &lt;code&gt;nqp::&lt;/code&gt;. In particular, getting env variables is now done using NQP, not Parrot directly. &lt;a href=&quot;https://github.com/rakudo/rakudo/commit/e9e1b5d9625d400453b922aca36417e96c040945&quot;&gt;e9e1b5d962&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">NQP on JVM bootstrapped, soon will land in NQP master</title>
		<link href="http://6guts.wordpress.com/2013/04/18/nqp-on-jvm-bootstrapped-soon-will-land-in-nqp-master/"/>
		<id>http://6guts.wordpress.com/?p=269</id>
		<updated>2013-04-18T16:37:13+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;The work to get NQP running and bootstrapped on the JVM has reached an interesting milestone, and I thought I’d take a few moments from working on it to talk about what has taken place since my last post here, as well as taking a look at what will be coming next.&lt;/p&gt;
&lt;h3&gt;Getting NQP on JVM Bootstrapped&lt;/h3&gt;
&lt;p&gt;When I last posted here, I had reached the point of having an NQP cross-compiler to the JVM that covered quite a lot of NQP’s language features. Cross-compilation meant using NQP on Parrot to parse NQP source, build an AST, and then turn the AST into a kind of JVM assembly language. This in turn was then transformed into a JVM bytecode file by a small tool written in Java, which could then be executed on the JVM.&lt;/p&gt;
&lt;p&gt;Since the last post, the cross-compiler became capable of cross-compiling NQP itself. This meant taking the NQP source files and using the cross-compiler to produce an NQP that would run on the JVM – without depending on Parrot. This also enabled support for eval-like scenarios. I reached this stage last month; the work involved tracking down a range of bugs, implementing some missing features, and doing a little more work to improve NQP’s portability. So, we had an NQP that ran on the JVM. Port done? Well, not quite.&lt;/p&gt;
&lt;p&gt;A little vacation later, I dug into the next stage: making NQP on the JVM able to compile (and thus reproduce) itself. While I’d already implemented the deserialization used to persist meta-objects (representing classes, grammars and so forth), for this next step I had to implement the serialization side of things. Thankfully, there are a bunch of tests for this, so this was largely “just” a matter of working through making them pass. Finally, it was time to work through the last few problems, and get NQP on JVM able to build the NQP sources – and therefore able to compile new versions of itself. I decided to do this work as part of moving the JVM support into the main NQP repository.&lt;/p&gt;
&lt;p&gt;Since we’ve only had NQP running on one backend (Parrot) up until now, certain aspects of the repository structure were not ideal. Before starting to bring in the JVM support, I first did a little bit of reorganization to segregate the VM specific components from the VM independent ones. Happily, much of NQP’s implementation falls into the latter category. Next came gradually building up the bootstrapping build process, working a file at a time, tracking down any issues that came up. This was a little tedious, especially given a couple of the problems were separate compilation leakages (where things from the running compiler would get confused with the version of the compiler that it was compiling). It was pretty clear that this was the problem from the errors I was seeing, but such problems show up long after things actually go wrong, requiring some careful analysis to hunt down. With those leaks plugged, and a few other relatively small bugs fixed, I had a working NQP on JVM…compiled by NQP on JVM.&lt;/p&gt;
&lt;p&gt;The work from there has been to fill out the rest of the build process, adding in the second bootstrap stage and the test targets. The good news: the NQP produced by NQP on JVM passes all the tests that the original cross-compiled version did, so we’ve got no regressions there as a result of the bootstrap.&lt;/p&gt;
&lt;p&gt;This work is currently sat in the jvm-support branch of the NQP repository. After the upcoming NQP release, it will be merged.&lt;/p&gt;
&lt;h3&gt;Supporting invokedynamic&lt;/h3&gt;
&lt;p&gt;Amongst all of this progress, we’ve also gained infrastructure to support using the invokedynamic instruction. This is a mechanism that enables those implementing non-Java languages on the JVM to teach its JIT about how their dispatch works. Most of the hard work here was done by donaldh++. I’d initially built things using BCEL in order to do code generation. While it served well up to a point, it turns out that &lt;a href=&quot;http://asm.ow2.org/&quot;&gt;ASM&lt;/a&gt; has much better support for invokedynamic, as well as being a little faster. So, donaldh got things switched over, and I soon was able to emit invokedynamic.&lt;/p&gt;
&lt;p&gt;So far, we are not using it a great deal (just for making QAST::WVal compile to something a bit – or potentially a lot – cheaper), but in the future it will be used for things you’d typically think of as invocations (sub and method calls). I’ll write in more detail about it as things evolve.&lt;/p&gt;
&lt;h3&gt;What next?&lt;/h3&gt;
&lt;p&gt;With NQP now ported, the focus will fall on Rakudo itself. Quite a lot of preparations have already been made; for example, many pir:: ops have been replaced with nqp:: ones, multiple dispatch has been ported to NQP from C (fixing some bugs along the way), the way HLL boundaries work has been updated to cope with a fully-6model world (this also let me fix a long-standing introspection bug).&lt;/p&gt;
&lt;p&gt;The path through getting Rakudo ported will largely follow the build order. This means starting with the module loader, then the compiler, followed by the MOP and its bootstrapping. After that comes the setting – the place where the built-ins live. There’s around 13,650 lines worth of that, so of course I expect to take it a little at a time. :-) I’ll try to remember to get a progress update here in a couple of weeks time.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/269/&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/269/&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=269&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">The REPL trick</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2013-repl-trick.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2013-repl-trick.html</id>
		<updated>2013-04-18T04:54:42+00:00</updated>
		<content type="html">&lt;p&gt;A recent &lt;a href=&quot;http://irclog.perlgeek.de/perl6/2013-04-15#i_6706783&quot;&gt;discussion on
IRC&lt;/a&gt; prompted me to share a small but neat trick with you.&lt;/p&gt;

&lt;p&gt;If there are things you want to do quite often in the Rakudo
REPL (the interactive &quot;Read-Evaluate-Print Loop&quot;), it makes sense to create a
shortcut for them. And creating shortcuts for often-used stuff is what
programming languages excel at, so you do it right in Perl module:&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;synPreProc&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;synStatement&quot;&gt;module&lt;/span&gt; REPLHelper&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; p(Mu &lt;span class=&quot;synStatement&quot;&gt;\x&lt;/span&gt;) &lt;span class=&quot;synIdentifier&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;export&lt;/span&gt; {
    &lt;span class=&quot;synStatement&quot;&gt;x.^&lt;/span&gt;mro&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;map&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;name&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
}

&lt;/pre&gt;

&lt;p&gt;I have placed mine in &lt;code&gt;$HOME/.perl6/repl&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And then you make sure it's loaded automatically:&lt;/p&gt;

&lt;pre&gt;$ alias p6repl=&quot;perl6 -I$HOME/.perl6/repl/ -MREPLHelper&quot;
$ p6repl
&amp;gt; p Int
Int Cool Any Mu
&amp;gt;
&lt;/pre&gt;

&lt;p&gt;Now you have a neat one-letter function which tells you the parents of an
object or a type, in method resolution order. And a way to add more shortcuts
when you need them.&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">Parrot 5.3.0 &quot;W00tstock Parrot&quot; Released! by Bruce Gray</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2013/04/msg693.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2013/04/msg693.html</id>
		<updated>2013-04-17T19:53:19+00:00</updated>
		<content type="html">We are stardust.&lt;br /&gt;Billion year old carbon.&lt;br /&gt;We are golden.&lt;br /&gt;Caught in the devil's bargain&lt;br /&gt;And we've got to get ourselves back to the garden.&lt;br /&gt;(To some semblance of a garden.)&lt;br /&gt;   -- &quot;Woodstock&quot;, by Joni Mitchell&lt;br /&gt;&lt;br /&gt;On behalf of the Parrot team, I'm proud to announce Parrot 5.3.0, also known&lt;br /&gt;as &quot;W00tstock Parrot&quot;.  Parrot (http://parrot.org/) is a virtual machine aimed&lt;br /&gt;at running all dynamic languages, and currently focusing on Perl 6.&lt;br /&gt;&lt;br /&gt;Parrot 5.3.0 is available on Parrot's FTP site&lt;br /&gt;(ftp://ftp.parrot.org/pub/parrot/releases/devel/5.3.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 5.3.0 News:&lt;br /&gt;   - Build&lt;br /&gt;       + Files generated by `make cover` are now correctly cleaned by `make`&lt;br /&gt;         and ignored by `git`.&lt;br /&gt;   - Tests&lt;br /&gt;       + Internal testing of the Configure probe for Fink now works correctly&lt;br /&gt;         with the --verbose flag.&lt;br /&gt;       + Tests added for .sort method of ResizableFloatArray and&lt;br /&gt;         ResizableIntegerArray. [GH #926], [GH #927]&lt;br /&gt;       + Benchmarks added for .sort methods of various Array objects.&lt;br /&gt;         [GH #175]&lt;br /&gt;       + Coverage analysis added for pbc_disassemble.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SHA256 message digests for the downloadable tarballs are:&lt;br /&gt;79d6f1fe20645b0afbc496cd0d7850a78b8940230e7637c5356d780f5aa1750b parrot-5.3.0.tar.gz&lt;br /&gt;4cff32521c79d8a783ad57d9a13e205ea3c1b1585085e0da80138b58b77d0ed5 parrot-5.3.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 21 May 2013.&lt;br /&gt;&lt;br /&gt;Enjoy!&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-2013 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes - 2013W15</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W15.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W15.html</id>
		<updated>2013-04-14T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I apologize I forgot about Perl 6 changes article yesterday. This ought not to happen, but it did. As for reason why it happened, well, I guess I will tell you anyway - it’s &lt;a href=&quot;https://minecraft.net/&quot; title=&quot;Minecraft&quot;&gt;that game&lt;/a&gt;.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Parcel&lt;/code&gt;s are allowed to have 0 elements.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.DUMP&lt;/code&gt; method can detect recursion for hashes.&lt;/li&gt;

&lt;li&gt;Added &lt;code&gt;ForeignCode&lt;/code&gt; for non-Perl 6 code objects (like C code).&lt;/li&gt;

&lt;li&gt;Removed lots of &lt;code&gt;pir::&lt;/code&gt; usage for JVM port of Rakudo.&lt;/li&gt;

&lt;li&gt;Semicolon after keyword that takes a block, like &lt;code&gt;PRE ;&lt;/code&gt; now has specific error message.&lt;/li&gt;

&lt;li&gt;Added &lt;code&gt;symlink&lt;/code&gt; and &lt;code&gt;link&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;require&lt;/code&gt; can take paths.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Added special cases for &lt;code&gt;big_pow&lt;/code&gt; when either of values is &lt;code&gt;-1&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt;, or &lt;code&gt;1&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes - 2013W14</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W14.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W14.html</id>
		<updated>2013-04-06T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;You may have noticed may page went down for some time. This appears to be connected to &lt;a href=&quot;https://github.com/blog/1452-new-github-pages-domain-github-io&quot; title=&quot;GitHub blog - New GitHub Pages domain: github.io&quot;&gt;newest domain change&lt;/a&gt;. In order to be more… modern, I’ve moved the repository to &lt;code&gt;glitchmr.github.io&lt;/code&gt;, but that made entire page to go down. I apologize for inconvience, but it didn’t affected Planet Six, so I think it’s fine.&lt;/p&gt;&lt;p&gt;As always, I’m going to describe changes in Perl 6.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;Renamed &lt;code&gt;weekday-of-month&lt;/code&gt; to &lt;code&gt;day-of-week-in-month&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Fixed signature of &lt;code&gt;Pod::Block.gist&lt;/code&gt;, so it works properly with &lt;code&gt;multi&lt;/code&gt;s.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;for&lt;/code&gt; loops are eager now.&lt;/li&gt;

&lt;li&gt;Added &lt;code&gt;Buf.perl&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Fixed &lt;code&gt;Buf.gist&lt;/code&gt;, so it works properly with &lt;code&gt;multi&lt;/code&gt;s.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Rakudo's Abstract Syntax Tree</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2013-rakudos-abstract-syntax-tree.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2013-rakudos-abstract-syntax-tree.html</id>
		<updated>2013-04-01T00:22:59+00:00</updated>
		<content type="html">&lt;p&gt;After or while a compiler parses a program, the compiler usually translates
the source code into a tree format called &lt;em&gt;Abstract Syntax Tree&lt;/em&gt;, or
&lt;em&gt;AST&lt;/em&gt; for short.&lt;/p&gt;

&lt;p&gt;The optimizer works on this program representation, and then the code
generation stage turns it into a format that the platform underneath it
can understand. Actually I wanted to write about the optimizer, but noticed
that understanding the AST is crucial to understanding the optimizer, so let's
talk about the AST first.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://rakudo.org/&quot;&gt;Rakudo Perl 6 Compiler&lt;/a&gt; uses an AST
format called &lt;em&gt;QAST&lt;/em&gt;. QAST nodes derive from the common superclass
&lt;code&gt;QAST::Node&lt;/code&gt;, which sets up the basic structure of all QAST
classes. Each QAST node has a list of child nodes, possibly a hash map for
unstructured annotations, an attribute (confusingly) named &lt;code&gt;node&lt;/code&gt;
for storing the lower-level parse tree (which is used to extract line numbers
and context), and a bit of extra infrastructure.&lt;/p&gt;

&lt;p&gt;The most important node classes are the following:&lt;/p&gt;

&lt;dl&gt;
    &lt;dt&gt;QAST::Stmts&lt;/dt&gt;
    &lt;dd&gt;A list of statements. Each child of the node is considered a separate
    statement.&lt;/dd&gt;
    &lt;dt&gt;QAST::Op&lt;/dt&gt;
    &lt;dd&gt;A single operation that usually maps to a primitive operation of the
    underlying platform, like adding two integers, or calling a routine.&lt;/dd&gt;
    &lt;dt&gt;QAST::IVal, QAST::NVal, QAST::SVal&lt;/dt&gt;
    &lt;dd&gt;Those hold integer, float (&quot;numeric&quot;) and string constants
    respectively.&lt;/dd&gt;
    &lt;dt&gt;QAST::WVal&lt;/dt&gt;
    &lt;dd&gt;Holds a reference to a more complex object (for example a class) which
    is serialized separately.&lt;/dd&gt;
    &lt;dt&gt;QAST::Block&lt;/dt&gt;
    &lt;dd&gt;A list of statements that introduces a separate lexical scope.&lt;/dd&gt;
    &lt;dt&gt;QAST::Var&lt;/dt&gt;
    &lt;dd&gt;A variable&lt;/dd&gt;
    &lt;dt&gt;QAST::Want&lt;/dt&gt;
    &lt;dd&gt;A node that can evaluate to different child nodes, depending on the
    context it is compiled it.&lt;/dd&gt;
&lt;/dl&gt;

&lt;p&gt;To give you a bit of a feel of how those node types interact, I want to
give a few examples of Perl 6 examples, and what AST they could produce. (It
turns out that Perl 6 is quite a complex language under the hood, and usually
produces a more complicated AST than the obvious one; I'll ignore that for
now, in order to introduce you to the basics.)&lt;/p&gt;

&lt;h2&gt;Ops and Constants&lt;/h2&gt;

&lt;p&gt;The expression &lt;code&gt;23 + 42&lt;/code&gt; could, in the simplest case, produce
this AST:&lt;/p&gt;

&lt;pre&gt;QAST::Op.new(
    :op('add'),
    QAST::IVal.new(:value(23)),
    QAST::IVal.new(:value(42)),
);
&lt;/pre&gt;

&lt;p&gt;Here an &lt;code&gt;QAST::Op&lt;/code&gt; encodes a primitive operation, an addition of
two numbers. The &lt;code&gt;:op&lt;/code&gt; argument specifies which operation to use.
The child nodes are two constants, both of type &lt;code&gt;QAST::IVal&lt;/code&gt;, which
hold the operands of the low-level operation &lt;code&gt;add&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now the low-level &lt;code&gt;add&lt;/code&gt; operation is not polymorphic, it always
adds two floating-point values, and the result is a floating-point value
again. Since the arguments are integers and not floating point values, they
are automatically converted to float first. That's not the desired semantics for Perl 6; actually the operator
&lt;code&gt;+&lt;/code&gt; is implemented as a subroutine of name
&lt;code&gt;&amp;amp;infix:&amp;lt;+&amp;gt;&lt;/code&gt;, so the real generated code is closer to&lt;/p&gt;

&lt;pre&gt;QAST::Op.new(
    :op('call'),
    :name('&amp;amp;infix:&amp;lt;+&amp;gt;'),    # name of the subroutine to call
    QAST::IVal.new(:value(23)),
    QAST::IVal.new(:value(42)),
);
&lt;/pre&gt;

&lt;h2&gt;Variables and Blocks&lt;/h2&gt;

&lt;p&gt;Using a variable is as simple as writing
&lt;code&gt;QAST::Var.new(:name('name-of-the-variable'))&lt;/code&gt;, but it must be declared
first. This is done with &lt;code&gt;QAST::Var.new(:name('name-of-the-variable'),
    :decl('var'), :scope('lexical'))&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;But there is a slight caveat: in Perl 6 a variable is always scoped to a
block. So while you can't ordinarily mention a variable prior to its
declaration, there are indirect ways to achieve that (lookup by name, and
&lt;code&gt;eval()&lt;/code&gt;, to name just two).&lt;/p&gt;

&lt;p&gt;So in Rakudo there is a convention to create &lt;code&gt;QAST::Block&lt;/code&gt; nodes
with two &lt;code&gt;QAST::Stmts&lt;/code&gt; children. The first holds all the
declarations, and the second all the actual code. That way all the declaration
always come before the rest of the code.&lt;/p&gt;

&lt;p&gt;So &lt;code&gt;my $x = 42; say $x&lt;/code&gt; compiles to roughly this:&lt;/p&gt;

&lt;pre&gt;QAST::Block.new(
    QAST::Stmts.new(
        QAST::Var.new(:name('$x'), :decl('var'), :scope('lexical')),
    ),
    QAST::Stmts.new(
        QAST::Op.new(
            :op('p6store'),
            QAST::Var.new(:name('$x')),
            QAST::IVal.new(:value(42)),
        ),
        QAST::Op.new(
            :op('call'),
            :name('&amp;amp;say'),
            QAST::Var.new(:name('$x')),
        ),
    ),
);
&lt;/pre&gt;

&lt;h2&gt;Polymorphism and QAST::Want&lt;/h2&gt;

&lt;p&gt;Perl 6 distinguishes between native types and reference types. Native types
are closer to the machine, and their type name is always lower case in Perl
6.&lt;/p&gt;

&lt;p&gt;Integer literals are polymorphic in that they can be either a native
&lt;code&gt;int&lt;/code&gt; or a &quot;boxed&quot; reference type &lt;code&gt;Int&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To model this in the AST, &lt;code&gt;QAST::Want&lt;/code&gt; nodes can contain
multiple child nodes. The compile-time context decides which of those is
acutally used.&lt;/p&gt;

&lt;p&gt;So the integer literal &lt;code&gt;42&lt;/code&gt; actually produces not just a simple
&lt;code&gt;QAST::IVal&lt;/code&gt; node but rather this:&lt;/p&gt;

&lt;pre&gt;QAST::Want.new(
    QAST::WVal(Int.new(42)),
    'Ii',
    QAST::Ival(42),
)
&lt;/pre&gt;

&lt;p&gt;(Note that &lt;code&gt;Int.new(42)&lt;/code&gt; is just a nice notation to indicate a
boxed integer object; it doesn't quite work like this in the code that
translate Perl 6 source code into ASTs).&lt;/p&gt;

&lt;p&gt;The first child of a &lt;code&gt;QAST::Want&lt;/code&gt; node is the one used by
default, if no other alternative matches. The comes a list where the elements
with odd indexes  are format specifications (here &lt;code&gt;Ii&lt;/code&gt; for
integers) and the elements at even-side indexes are the AST to use in that
case.&lt;/p&gt;

&lt;p&gt;An interesting format specification is &lt;code&gt;'v'&lt;/code&gt; for void context,
which is always chosen when the return value from the current expression isn't
used at all. In Perl 6 this is used to eagerly evaluate lazy lists that are
used in void context, and for several optimizations.&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">Perl 6 changes - 2013W13</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W13.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W13.html</id>
		<updated>2013-03-30T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;The month is coming to end, and with that, I’m going to make yet another list of changes.&lt;/p&gt; id='new_features_like_anything_is_other_than_that'&amp;gt;New features (like anything is other than that)&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;Added many &lt;code&gt;IO::Path&lt;/code&gt; methods: &lt;code&gt;.contents&lt;/code&gt;, &lt;code&gt;.is-absolute&lt;/code&gt;, &lt;code&gt;.is-relative&lt;/code&gt;, &lt;code&gt;.absolute&lt;/code&gt;, and &lt;code&gt;.relative&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;.path&lt;/code&gt; is now NOP that returns itself. For its previous behavior, use &lt;code&gt;.Str&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Changed &lt;code&gt;Numeric.conjugate&lt;/code&gt; to &lt;code&gt;Numeric.conj&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;+(23..2300000000)&lt;/code&gt; is optimized.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;--help&lt;/code&gt; reports &lt;code&gt;-I&lt;/code&gt; and &lt;code&gt;-M&lt;/code&gt; options.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Polish Perl Workshop status update</title>
		<link href="http://ttjjss.wordpress.com/2013/03/27/polish-perl-workshop-status-update/"/>
		<id>http://ttjjss.wordpress.com/?p=225</id>
		<updated>2013-03-27T11:56:41+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Exactly two months remain until Polish Perl Workshop this year. In case you didn’t know, I’m shamelessly reposting the &lt;a href=&quot;http://act.yapc.eu/plpw2013/news/1006&quot;&gt;status update from our ACT website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We’ve got the first sponsor offers, and about 15 talk submissions so far. Awesome! However, as we are well aware that most of you will wait to submit talks until there’s less than 2 days until the deadline (or later :)) I’m hereby announcing: &lt;strong&gt;The talk submission deadline for Polish Perl Workshop 2013 is 14 of April&lt;/strong&gt;. That’s about two weeks to finally make up your mind and submit something. Please do! There’ll be only one chance to talk at the First Polish Perl Workshop: there’ll be no other :)&lt;/p&gt;
&lt;p&gt;Of course, if you’d prefer to organize more of a hands-on event, we have the entire sunday dedicated to hackathon, BoFs, classes etc. If you want to submit something more lenghty, that’s the right way to do it.&lt;/p&gt;
&lt;p&gt;In other interesting news, we started looking at conference t-shirts (yes, they’re free for all attendees). We have something on our mind that never happened before on a Perl conference (or at least I’ve never seen or heard of something like this). We’ll keep you informed.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/ttjjss.wordpress.com/225/&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/225/&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=225&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">Parrot 5.2.0 &quot;Stuffed Parrot&quot; Released! by Bruce Gray</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2013/03/msg692.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2013/03/msg692.html</id>
		<updated>2013-03-24T13:58:55+00:00</updated>
		<content type="html">I am not dead yet                               I can dance and I can sing&lt;br /&gt;I am not dead yet                              I can do the Highland Fling&lt;br /&gt;I am not dead yet                                     No need to go to bed&lt;br /&gt;No need to call the doctor                          Cause I'm not yet dead&lt;br /&gt;    -- Spamalot&lt;br /&gt;&lt;br /&gt;On behalf of the Parrot team, I'm proud to announce Parrot 5.2.0, also known&lt;br /&gt;as &quot;Stuffed 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 5.2.0 is available on Parrot's FTP site&lt;br /&gt;(ftp://ftp.parrot.org/pub/parrot/releases/devel/5.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 5.2.0 News:&lt;br /&gt;    - Core&lt;br /&gt;        + IO now only syncs buffers for the IO types where syncing makes sense.&lt;br /&gt;            = PIO_VF_SYNC_IO flag added&lt;br /&gt;    - Build&lt;br /&gt;        + installable_pdump now has the correct rpath (blib corrected to lib).&lt;br /&gt;    - Libraries&lt;br /&gt;        + Tcl/Glob.pir has been removed. (PGE/Glob.pir remains intact)&lt;br /&gt;    - Ecosystem&lt;br /&gt;        + All Parrot tarballs are now symlinked to the 'all' directory,&lt;br /&gt;          regardless of their true homes ('devel' or 'stable'), to better&lt;br /&gt;          allow for automated downloads.&lt;br /&gt;            ftp://ftp.parrot.org/pub/parrot/releases/all/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SHA256 message digests for the downloadable tarballs are:&lt;br /&gt;1245d11f2b2ea44e6465aff6da5a533324d69b6eb3ddf7d84e81385ea95150ad parrot-5.2.0.tar.gz&lt;br /&gt;0c538d780f9c70c510e142a8a663c30474125c9fcf9fe25d2129e68fc7baec8d parrot-5.2.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 16 Apr 2013.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;br /&gt;-- &lt;br /&gt;Bruce Gray (Util of PerlMonks)&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-2013 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes - 2013W12</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W12.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W12.html</id>
		<updated>2013-03-23T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I really should optimize my blog layout, so empty intro wouldn’t be ugly. But I guess I’m too lazy to do it right now, so I have to explain stuff. Every week, I list the list of changes in Perl 6 specifications, and its implementations. That’s just everything, boring, I know. Still, it doesn’t look that bad on Planet Six, so I guess I will continue to make these articles :-).&lt;/p&gt;&lt;p&gt;This week, the Rakudo 2013.03 was released. Every change mentioned here was implemented in it.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;Added &lt;code&gt;X::Range::InvalidArg&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Removed lots of &lt;code&gt;pir::&lt;/code&gt; usage.&lt;/li&gt;

&lt;li&gt;Multi dispatch is now implemented in NQP, not C.&lt;/li&gt;

&lt;li&gt;Released Rakudo 2013.03.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Reading from a file in Perl 6</title>
		<link href="http://perl6maven.com/reading-from-a-file-in-perl6"/>
		<id>http://perl6maven.com/reading-from-a-file-in-perl6</id>
		<updated>2013-03-19T20:52:02+00:00</updated>
		<content type="html">&lt;p&gt;
It can be interesting to do operations on existing data structures in Perl 6, but without Input and Output,
that would have limited usability in the real world.
&lt;/p&gt;&lt;p&gt;
Therefore reading from files is a critical operation.
&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</content>
		<author>
			<name>szabgab</name>
			<uri></uri>
		</author>
		<source>
			<title type="html">Perl 6 Maven</title>
			<link rel="self" href="http://perl6maven.com/atom"/>
			<id>http://perl6maven.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes - 2013W11</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W11.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W11.html</id>
		<updated>2013-03-16T07:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I would put nothing here, but the layout of blog would make this look ugly. So, well, like usually I put something here, even if it is meaningless. Just look below to see list of changes.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Closing brace, followed by newline and infix operator was parsed incorrectly. For example, following code.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;my %a;
{ }
%a&amp;lt;b&amp;gt; = 1;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Was parsed like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;my %a;
{ } % a()&amp;lt;b&amp;gt; = 1;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Instead of correct.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;my %a;
{ };
%a&amp;lt;b&amp;gt; = 1;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Done more &lt;code&gt;pir::&lt;/code&gt; to &lt;code&gt;nqp::&lt;/code&gt; replacements in order to help JVM port of Rakudo Perl.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Case insensitive matches with strings now work.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;my $nonsense = 'asdf';
say &quot;OK&quot; if &quot;ADSF&quot; ~~ m:i/$nonsense/;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Typing &lt;code&gt;else if&lt;/code&gt; and &lt;code&gt;elif&lt;/code&gt; after &lt;code&gt;if&lt;/code&gt; block shows “Please use ‘elsif’” error message.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;code&gt;&amp;amp;?ROUTINE&lt;/code&gt; variable is available inside &lt;code&gt;regex foo { ... }&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;The named params are optimized in compile time when possible.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;code&gt;X::Method::NotFound&lt;/code&gt; is raised even when dealing with &lt;code&gt;&quot;&quot;&lt;/code&gt; (empty) method names.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Fixed proto of &lt;code&gt;infix:&amp;lt;ne&amp;gt;&lt;/code&gt; in order to require &lt;code&gt;Mu&lt;/code&gt; objects.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;code&gt;Stash.at_key&lt;/code&gt; method now works.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Postcircumfix calls can be cached now.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;code&gt;LEAVE&lt;/code&gt; is now fired on &lt;code&gt;next&lt;/code&gt;/&lt;code&gt;last&lt;/code&gt; in &lt;code&gt;MapIter&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Exception is thrown when &lt;code&gt;Range&lt;/code&gt; endpoint is used to create a Range.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Empty.gist&lt;/code&gt; returns nothing.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Getting started with Rakudo * (2013.01) on Windows</title>
		<link href="http://perl6maven.com/getting-started-with-rakudo-star-2013-01-on-windows"/>
		<id>http://perl6maven.com/getting-started-with-rakudo-star-2013-01-on-windows</id>
		<updated>2013-03-15T20:52:02+00:00</updated>
		<content type="html">&lt;p&gt;
After a break of several months, I rebuild Rakudo on the server, a few days ago,
and regenerated the Perl 6 Maven pages. This promptly broke the site. The fix was easy, and as expected the bug was mine.
&lt;/p&gt;&lt;p&gt;
Today I decided to try Rakudo on my Windows machine as well, but I went for the easy
route and installed the pre-built msi file.
&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</content>
		<author>
			<name>szabgab</name>
			<uri></uri>
		</author>
		<source>
			<title type="html">Perl 6 Maven</title>
			<link rel="self" href="http://perl6maven.com/atom"/>
			<id>http://perl6maven.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes - 2013W10</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W10.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W10.html</id>
		<updated>2013-03-09T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;During making this update, I had lots of problems with Internet. I have managed to load commits history for every repository I check, but I haven’t checked commits. Will update this after Internet access will be more stable.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Rat.perl&lt;/code&gt; returns decimal number when denominator is normalizable to a power of 10.&lt;/li&gt;

&lt;li&gt;Added FALLBACK methods.&lt;/li&gt;

&lt;li&gt;Included Failure in smartmatch passthroughs.&lt;/li&gt;

&lt;li&gt;Loosened relationship between &lt;code&gt;Nil&lt;/code&gt; and &lt;code&gt;()&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Added &lt;code&gt;List.permutations&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;rat64&lt;/code&gt; type has unsigned denominator.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;stdpm6&quot;&gt;STD.pm6&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Nil&lt;/code&gt; isn’t suggested for empty list in error messages anymore.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Fixed expanding of variables that don’t exist when converting string to RegExp. For example, &lt;code&gt;&quot;a&quot; ~~ / &amp;lt;$blah&amp;gt; /&lt;/code&gt; is fixed.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;Rat.perl&lt;/code&gt; returns decimal number when denominator is normalizable to a power of 10.&lt;/li&gt;

&lt;li&gt;Removed lots of &lt;code&gt;pir::&lt;/code&gt; usage in order to help porting Rakudo to JVM.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;Rat.perl&lt;/code&gt; provides angle brackets around fractional forms.&lt;/li&gt;

&lt;li&gt;Added missing shellwords postcircumfixes (&lt;code&gt;&amp;lt;&amp;lt; &amp;gt;&amp;gt;&lt;/code&gt; and &lt;code&gt;« »&lt;/code&gt;).&lt;/li&gt;

&lt;li&gt;Generalized “augment” check, and made error message more generic.&lt;/li&gt;

&lt;li&gt;User defined circumfixes are parsed just like STD.pm6 does.&lt;/li&gt;

&lt;li&gt;Added colorcircumfixes.&lt;/li&gt;

&lt;li&gt;Rakudo now warns about integers starting with &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Mistakes like &lt;code&gt;if(1 &amp;lt; 2) { ... }&lt;/code&gt; (where mistake is that &lt;code&gt;if&lt;/code&gt; is called like a function) give good errors.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;Nil&lt;/code&gt; isn’t suggested for empty list in error messages anymore.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Rat.perl&lt;/code&gt; returns decimal number when denominator is normalizable to a power of 10.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;CommonEnum.gist&lt;/code&gt; returns &lt;code&gt;(Type)&lt;/code&gt; instead of &lt;code&gt;Type()&lt;/code&gt; for undefined.&lt;/li&gt;

&lt;li&gt;Restored &lt;code&gt;infix:&amp;lt;cmp&amp;gt;&lt;/code&gt; sorting for different types.&lt;/li&gt;

&lt;li&gt;Failed matches return &lt;code&gt;Nil&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Philosophical Issues with Rakudo’s .parse</title>
		<link href="http://justrakudoit.wordpress.com/2013/03/06/philosophical-issues-with-rakudos-parse/"/>
		<id>http://justrakudoit.wordpress.com/?p=464</id>
		<updated>2013-03-06T12:59:01+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;For a little bit now I’ve had the ABC module working on both Niecza and Rakudo.  I got a new Linux box yesterday; this morning I was playing around with my ABC tools there, trying to see if I could get them to work.  I installed them with panda, so I was using ABC with Niecza by default on my MBP and with Rakudo by default on my new machine.  I tried it with a file of my own compositions.  Apparently I hadn’t tried this in a while, because it had several issues.   And the two systems handled them completely differently.&lt;/p&gt;
&lt;p&gt;On Niecza, I got this message:&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;Unhandled exception: Did not match ABC grammar: last tune understood:
 A Hat for the Whales
d|:e~A3 BGEF|G2BG DG (3ABd|eBdB ~A3G|Bdef gfed|
e~A3 BGEF|G2BG DG (3ABd|eBdB AAGA|[1Beed e3d:|
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;On Rakudo, there were no error messages, but “A Hat for the Whales” was the last tune processed, even though there were a dozen more tunes in the ABC file after it.&lt;/p&gt;
&lt;p&gt;Without thinking about it too much I corrected this batch of errors.  Now on Niecza the entire file parsed, but I got the error&lt;br /&gt;

Unhandled exception: Illegal key signature B minor
&lt;br /&gt;
Under Rakudo, the same ABC file just appeared to work.&lt;/p&gt;
&lt;p&gt;What’s going on here?  Well, key signature processing looks something like this (simplified):&lt;br /&gt;
&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;    token key-def { &amp;lt;basenote&amp;gt; &amp;lt;chord_accidental&amp;gt;? &amp;lt;mode&amp;gt;? }
    token mode { &amp;lt;minor&amp;gt; | &amp;lt;major&amp;gt; }
    token minor { &quot;m&quot; [&quot;in&quot; [&quot;o&quot; [&quot;r&quot;]?]?]? }
    token major { &quot;maj&quot; [&quot;o&quot; [&quot;r&quot;]?]? }
&lt;/pre&gt;&lt;br /&gt;
No space allowed between &lt;code&gt;basenote&lt;/code&gt; and &lt;code&gt;mode&lt;/code&gt;.  So when you invoke parse with that rule on “B minor”, in Niecza it fails, because the entire string was not successfully parsed.  In Rakudo it succeeds, because “B” is a valid key signature, and it doesn’t care that the entire string was not parsed.  In practice, this means that three of the tunes in the collection got the wrong key signature: B major instead of the correct B minor.&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To my mind, Niecza’s behavior is more intuitive.  If you’re trying to parse a file, parsing half of it and then silently ignoring the rest is wildly unhelpful behavior.  In every use I’ve had for parse so far, I’ve wanted it to parse everything in the string I sent to the function.&lt;/p&gt;
&lt;p&gt;But hey, I understand that some people might have different needs.  Can we at least add a flag that will give you a parsing failure if the entire string is not parsed?  &lt;code&gt;:all&lt;/code&gt;, perhaps?&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/justrakudoit.wordpress.com/464/&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/464/&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=464&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">Perl 6 changes - 2013W09</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W09.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W09.html</id>
		<updated>2013-03-02T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I would put a description, but who seriously cares?&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;Inside of &lt;code&gt;try&lt;/code&gt; is considered eager context, unless &lt;code&gt;try&lt;/code&gt; is called in sink context, when it’s in sink context.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Type placeholders (like &lt;code&gt;Int&lt;/code&gt;, which is null, except Int typed) now have their &lt;code&gt;.gist&lt;/code&gt; method show their name within parens to suggest being undefined. For example, &lt;code&gt;(Int)&lt;/code&gt;, &lt;code&gt;(Mu)&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Changed “Cannot assign to a non-container” error message to “Cannot modify an immutable value” that hopefully is more clear.&lt;/li&gt;

&lt;li&gt;Release announcements now use Markdown.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;Cool.substr&lt;/code&gt; doesn’t coerce its first argument to &lt;code&gt;Int&lt;/code&gt; anymore.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">I made a pointless webpage</title>
		<link href="http://glitchmr.github.com/i-made-a-pointless-webpage.html"/>
		<id>http://glitchmr.github.com/i-made-a-pointless-webpage.html</id>
		<updated>2013-03-01T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;So, well, I have a VPS, and decided to put a webpage on it for lulz. You can see it at &lt;a href=&quot;http://mango.uk.to/&quot;&gt;mango.uk.to&lt;/a&gt;, and the source (sauce) is available on &lt;a href=&quot;https://github.com/GlitchMr/Mango&quot;&gt;my GitHub profile&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Just mentioning, not that this site is important. I just wanted to run a web server just to run a web server.&lt;/p&gt;&lt;p&gt;By the way, this blog is also open sauce, you can see its source code &lt;a href=&quot;https://github.com/GlitchMr/glitchmr.github.com&quot;&gt;on GitHub&lt;/a&gt;. It’s full of hacks, but that’s Jekyll for you.&lt;/p&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en-US">Rakudo Star 2013.02 released</title>
		<link href="http://rakudo.org/2013/02/24/rakudo-star-2013-02-released/"/>
		<id>http://rakudo.org/?p=248</id>
		<updated>2013-02-24T19:21:21+00:00</updated>
		<content type="html" xml:lang="en-US">&lt;p&gt;On behalf of the Rakudo and Perl 6 development teams, I’m happy to announce the February 2013 release of “Rakudo Star”, a useful and usable distribution of Perl 6.  The tarball for the  February 2013 release is available from &lt;a href=&quot;http://rakudo.org/downloads/star/&quot;&gt;http://rakudo.org/downloads/star/&lt;/a&gt;.  A Windows .MSI version of Rakudo star will usually appear in the downloads area shortly after the tarball release.&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 &lt;a href=&quot;https://github.com/rakudo/rakudo/blob/nom/docs/announce/2013.02&quot;&gt;release 2013.02.1&lt;/a&gt; of the &lt;a href=&quot;http://rakudo.org/&quot;&gt;Rakudo Perl 6 compiler&lt;/a&gt;, version 4.10.0 of the &lt;a href=&quot;http://parrot.org/&quot;&gt;Parrot Virtual Machine&lt;/a&gt;, and various modules, documentation, and other resources collected from the Perl 6 community.&lt;/p&gt;
&lt;p&gt;Some of the new features added to this release include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;“Did you mean …” suggestions for symbol-not-found errors&lt;/li&gt;
&lt;li&gt;Compile-time optimization of some cases of junctions in boolean context&lt;/li&gt;
&lt;li&gt;IO::Socket.get now works again with non-ASCII characters&lt;/li&gt;
&lt;li&gt;constant folding for routines marked as ‘is pure’&lt;/li&gt;
&lt;li&gt;natively typed variables and better error reporting in the REPL&lt;/li&gt;
&lt;li&gt;speed up eqv-comparison of Bufs&lt;/li&gt;
&lt;li&gt;warnings for useless use of (some) literals, variables and constant expressions in sink context&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This release also contains a range of bug fixes, improvements to error reporting&lt;br /&gt;
and better failure modes. &lt;/p&gt;
&lt;p&gt;The following features have been deprecated or modified from previous&lt;br /&gt;
releases due to changes in the Perl 6 specification, and are being removed&lt;br /&gt;
or changed as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;.gist on a type object will return ‘(Typename)’ instead of ‘Typename()’.  If you want to get the class name alone, continue to use $obj.^name&lt;/li&gt;
&lt;li&gt;postcircumfix:&amp;lt;[ ]&amp;gt; and postcircumfix:&amp;lt;{ }&amp;gt; will become multi-subs rather than multi-methods. Both at_pos and at_key will remain methods.&lt;/li&gt;
&lt;li&gt;Unary hyper ops currently descend into nested arrays and hashes.  This will change to make them equivalent to a one-level map.&lt;/li&gt;
&lt;li&gt;The Str.ucfirst builtin is deprecated; it will be replaced by Str.tc.&lt;/li&gt;
&lt;li&gt;Leading whitespace in rules and under :sigspace will no longer be converted to &amp;lt;.ws&amp;gt; .  For existing regexes that expect this conversion, add a &amp;lt;?&amp;gt; in front of leading whitespace to make it meta again.&lt;/li&gt;
&lt;li&gt;The ?-quantifier on captures in regexes currently binds the capture slot to a List containing either zero or one Match objects; i.e., it is equivalent to “** 0..1″.  In the future, the ?-quantifier will bind the slot directly to a captured Match or to Nil.  Existing code can manage the transition by changing existing ?-quantifiers to use “** 0..1″, which will continue to return a List of matches.&lt;/li&gt;
&lt;/ul&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;/p&gt;
&lt;ul&gt;
&lt;li&gt;advanced 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;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 an online resource at http://perl6.org/compilers/features&lt;br /&gt;
that lists the known implemented and missing features of Rakudo&lt;br /&gt;
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;a&gt;&lt;br /&gt;
href=&quot;mailto:rakudobug@perl.org&quot;&amp;gt;rakudobug@perl.org&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&quot;http://perl6.org/&quot;&gt;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.  A draft of a Perl 6 book is available as UsingPerl6-draft.pdf&amp;gt; in the release tarball.&lt;/p&gt;&lt;p&gt;
&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 &lt;a href=&quot;http://rakudo.org/how-to-help&quot;&gt;http://rakudo.org/how-to-help&lt;/a&gt;, ask on the perl6-compiler@perl.org mailing list, or join us on IRC #perl6 on freenode.&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">Perl 6 changes - 2013W08</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W08.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W08.html</id>
		<updated>2013-02-23T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Now, I’m back to the your regularly scheduled Perl 6 changes article that isn’t. Well, it is, but it’s not. Or something. Rakudo 2013.02.1 was released (well, 2013.02 was released too). The version bump was caused by the fact that NQP 2013.02 had broken native call support.&lt;/p&gt; id='incompatible_changes'&amp;gt;Incompatible changes&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;Failed matches result &lt;code&gt;Nil&lt;/code&gt;, not &lt;code&gt;(Match)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;/h2&gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;Removed &lt;code&gt;Set.powerset&lt;/code&gt;. It was removed after 10 hours of existing. Consider it a printing error in my previous article, or something. Not really an incompatible change, as it practically never existed.&lt;/li&gt;

&lt;li&gt;Type placeholders (like &lt;code&gt;Int&lt;/code&gt;, which is null, except Int typed) now have their &lt;code&gt;.gist&lt;/code&gt; method show their name within parens to suggest being undefined. For example, &lt;code&gt;(Int)&lt;/code&gt;, &lt;code&gt;(Mu)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;stdpm6&quot;&gt;STD.pm6&amp;gt;&lt;ul&gt;
&lt;li&gt;Added a warning for smartmatch of &lt;code&gt;(Match)&lt;/code&gt; or &lt;code&gt;(Nil)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;The sink context now can be detected. Side-effect-free operations, constants and variables warn about it.&lt;/li&gt;

&lt;li&gt;Compiler warns about apparent subscripts in regexes being treated as regexes (for example, &lt;code&gt;@a[0]&lt;/code&gt;, which is treated as any of &lt;code&gt;@a&lt;/code&gt; elements followed by &lt;code&gt;0&lt;/code&gt;).&lt;/li&gt;

&lt;li&gt;It’s possible to interpolate arrays in regular expressions.&lt;/li&gt;

&lt;li&gt;Added &lt;code&gt;int64&lt;/code&gt; native type.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;/./&lt;/code&gt; and &lt;code&gt;rx/./&lt;/code&gt; now matches against &lt;code&gt;$_&lt;/code&gt; in sink context.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;$feature is not yet implemented. Sorry.&lt;/code&gt; error message doesn’t have &lt;code&gt;is&lt;/code&gt; anymore.&lt;/li&gt;

&lt;li&gt;Coercive type declarations make not yet implemented error.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Type placeholders (like &lt;code&gt;Int&lt;/code&gt;, which is null, except Int typed) now have their &lt;code&gt;.gist&lt;/code&gt; method show their name within parens to suggest being undefined. For example, &lt;code&gt;(Int)&lt;/code&gt;, &lt;code&gt;(Mu)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">t1: Tell knights from knaves</title>
		<link href="http://strangelyconsistent.org/blog/t1-tell-knights-from-knaves"/>
		<id>tag:strangelyconsistent.org,2013-02-22:blog/t1-tell-knights-from-knaves</id>
		<updated>2013-02-22T22:39:50+00:00</updated>
		<content type="html">&lt;div style=&quot;background: #ded; margin: 1em; padding: 1em;&quot;&gt;&lt;code&gt;&amp;lt;grondilu&amp;gt; masak: are you sure problem #1 is computationnaly doable?  It's not NP = P or something, is it?&lt;br /&gt;
* grondilu thinks of it and realizes the number of possibilities is not so large&lt;br /&gt;
&amp;lt;grondilu&amp;gt; .oO( 2**number_of_islanders  possibilities anyway )&lt;/code&gt;&lt;/div&gt;

&lt;p&gt;And so, the time-honored tradition of reviewing &lt;a href=&quot;http://github.com/masak/p6cc2012#readme&quot;&gt;p6cc&lt;/a&gt; solutions begins. Again.&lt;/p&gt;

&lt;p&gt;For our first task, we have the very human conundrum of figuring out who is telling the truth and who is lying. Fortunately, on the island of Smul, that's a much more tractable problem than in the real world.&lt;/p&gt;

&lt;p&gt;The problem description follows.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;## Tell knights from knaves based on what they say

On the mythical island of Smul, people suffer from a rare genetic disorder that
make them either tell the truth all the time, or lie all the time. These are
the only two types of people on the island, known as knights and knaves,
respectively.

Write a program that takes as input a number of utterances by islanders, and
outputs for each person whether that person is a knight or a knave. If there is
no possible assignment that works, the program should report that no solution
exists. In the case of multiple solutions, the program should report every
possible solution.

The islanders can make four different classes of utterances:

    X is a knight.
    X is a knave.
    X and Y are of the same type.
    X and Y are of different types.

(Here, X and Y are used as metavariables, of course, and can in fact be any
name of an islander.)

Islanders can refer to each other. The same islander can make several
utterances. If an islander mentions another islander that doesn't say anything,
your program should consider the entire input to be erroneous.

Here are a few examples:

    A: A is a knight.

Both a knight and a knave would assert the same thing. So this input has two
solutions.

    B: B is a knave.

Neither a knight or a knave would ever say this about themselves. So this input
allows no solution.

    C: C and D are of the same type.
    D: D and C are of different types.

Here, the two islanders are contradicting each other, so one of them must be a
knight and the other a knave. But this is exactly what D is saying, so D is the
knight. One solution.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let's get one obvious thing out of the way: we can solve this with a brute-force method, supposing for each islander in a situation first that he is a knight and then that he is a knave. Each islander thus bifurcates the universe in two possible universes. Two islanders will yield four possible universes to investigate. Three islanders will yield eight universes. Ten islanders will yield 1024 universes. The universes grow exponentially with the islanders. The brute-force solution will always &lt;em&gt;work&lt;/em&gt;, but at an exponential slowdown.&lt;/p&gt;

&lt;p&gt;Many people choose the brute-force solution. I don't blame them; it's there for the picking. Some people get fancy with logical propositions or &quot;affiliations&quot; between islanders, but they all fall down the exponential pit at one point or another. The brute-forcers are all over the place in terms of style and brevity, and it's quite fun to watch.&lt;/p&gt;

&lt;p&gt;Then there's this &lt;em&gt;one&lt;/em&gt; contestant that gets the nice solution. It always thrills me when that happens.&lt;/p&gt;

&lt;p&gt;Here, let me lay it out for you. Let 0 mean &lt;code&gt;False&lt;/code&gt;/knave and 1 mean &lt;code&gt;True&lt;/code&gt;/knight. Then let's translate the four possible utterances to equations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&quot;A: X is a knight.&quot; → A = X&lt;/li&gt;
&lt;li&gt;&quot;A: X is a knave.&quot; → A = 1 xor X&lt;/li&gt;
&lt;li&gt;&quot;A: X and Y are of the same type.&quot; → A = 1 xor X xor Y&lt;/li&gt;
&lt;li&gt;&quot;A: X and Y are of different types.&quot; → A = X xor Y&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By some amazing coincidence, all the utterances can be put into more or less the same mold, and the only operator used is xor. It's actually fun to translate these formulas back, and get alternative formulations of things, sometimes giving a different perspective on things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A = X → &quot;A is as truthful as X&quot;&lt;/li&gt;
&lt;li&gt;A = 1 xor X → &quot;A or X is truthful, but not both&quot;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From that first formulation we see why, when A is asserting that A is a knight, that utterance devolves into a tautology A = A. It's as if an islander cannot assert his own knighthood solely on his own authority.&lt;/p&gt;

&lt;p&gt;From the second formulation we see why, when A is asserting that A is a knave, such an utterance devolves into a contradiction A = 1 xor A. There just isn't any such number A. (We'd have to look in the murky domain of fuzzy logic, but that's outside the realm of the island of Smul.)&lt;/p&gt;

&lt;p&gt;Anyway, translating all the utterances to this form is a &lt;em&gt;big&lt;/em&gt; win. Now we can make a linear equation system of all the utterances, and solve the linear equation system. Do we have fast algorithms for that? Yes, we do! Gaussian elimination has an arithmetic complexity of O(n&lt;sup&gt;3&lt;/sup&gt;). That's quite an improvement on exponential brute force!&lt;/p&gt;

&lt;p&gt;We must take care to do all the additions and subtractions as xors, though. This is because our underlying algebra is truth values, outside of which we may not stray. So we're really doing Gaussian elimination on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quotient_ring&quot;&gt;quotient ring&lt;/a&gt; Z/2Z.&lt;/p&gt;

&lt;p&gt;In the literature, we find this problem as &lt;a href=&quot;https://en.wikipedia.org/wiki/3SAT#XOR-satisfiability&quot;&gt;XOR-satisfiability&lt;/a&gt;. Wikipedia dignifies it with two sentences.&lt;/p&gt;

&lt;p&gt;One contestant did it this way. Yay him. You should check out his solution.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/masak/p6cc2012/tree/master/t1/review&quot;&gt;Here are the solutions&lt;/a&gt;, and my reviews of same. Enjoy.&lt;/p&gt;

&lt;p&gt;Next up: rectangle haikus, possibly the most fun I've ever had with a p6cc task.&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">friendly interactive shell</title>
		<link href="http://glitchmr.github.com/friendly-interactive-shell.html"/>
		<id>http://glitchmr.github.com/friendly-interactive-shell.html</id>
		<updated>2013-02-22T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I’m not sure if anybody noticed, but lately, nothing was happening on my blog. So, I’m going to write an article about friendly interactive shell (fish), the best shell I’ve used ever (it’s my personal opinion, in case you haven’t noticed, see my footer blog). Actually, I think I’ve moved to it half of the year ago or something.&lt;/p&gt;&lt;p&gt;These days, the two popular shells exist - bash and Z shell. I’m aware of that more shells exist - just nobody uses them these days By the way, if you try to find logical fallacy, I agree, cmd.exe and Windows PowerShell are often used, but those aren’t UNIX shells. Oh, and programming language REPLs are often used too (like irb), but they aren’t UNIX shells too.&lt;/p&gt; id='bash'&amp;gt;Bash&amp;gt;&lt;p&gt;The bash shell is standard shell, included in many Linux distributions. It will make you bash your head against the brick wall (pun intended).&lt;/p&gt;&lt;p&gt;One of examples of bash code I could have found is this. And trust me, it’s not the worst thing (thanks, &lt;a href=&quot;https://en.wikibooks.org/wiki/Bash_Shell_Scripting#Non-integer_arithmetic&quot; title=&quot;Wikibooks: Bash Shell Scripting&quot;&gt;Wikibooks&lt;/a&gt;).&lt;/p&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# print the powers of two, from 1 to 512:&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 1; i &amp;lt; 1000; i *&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; 2&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$i&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Do you see double parens here? This is really strange math syntax that only supports integers. Why double parenthesis? Well, the answer is compatibility with Bourne shell (really, really old shell, usually called sh (but sometimes sh is actually bash, to make you bash)).&lt;/p&gt;&lt;p&gt;Also, you could have noticed keywords &lt;code&gt;do&lt;/code&gt; and &lt;code&gt;done&lt;/code&gt;. Bash could easily not require &lt;code&gt;do&lt;/code&gt; keyword before &lt;code&gt;for&lt;/code&gt; loop body. Yet, it’s required. The other strange quirks is that you aren’t allowed to put semicolon after &lt;code&gt;do&lt;/code&gt; keyword. Why? I’ve no idea, really. The &lt;code&gt;done&lt;/code&gt; word, while I think it’s needed, differs between blocks. For example, &lt;code&gt;if&lt;/code&gt; blocks end with &lt;code&gt;fi&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;Bourne again shell has lots of strange syntax you really wouldn’t ever use. For example, bash has &lt;code&gt;$''&lt;/code&gt; syntax. It unescapes escape sequences inside. The strange part is &lt;code&gt;''&lt;/code&gt; in bash doesn’t do any processing at all, yet &lt;code&gt;$''&lt;/code&gt; does. Bash also has &lt;code&gt;$&quot;&quot;&lt;/code&gt; syntax, but it doesn’t do escape processing - instead it uses gettext to translate string inside.&lt;/p&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# Prints 'Hello world.', with new line in middle.&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;Hello&lt;span class=&quot;s1&quot;&gt;$'\n'&lt;/span&gt;world.
&lt;span class=&quot;c&quot;&gt;# Prints 'Hello\nworld.', literally.&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;Hello&lt;span class=&quot;s2&quot;&gt;$&quot;\n&quot;&lt;/span&gt;world.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Consistency in bash is even worse than in languages such as PHP. There are many ways to do something, but none of them are obvious. And I mean that, none. Expanding bash is adding new syntax that totally doesn’t make sense, but was a syntax error in previous versions. &lt;code&gt;$&lt;/code&gt; sign is used for many features that have nothing with variables.&lt;/p&gt;&lt;p&gt;Also, bash integrates many programs in it that really shouldn’t be inside. For example, &lt;code&gt;echo&lt;/code&gt;.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;[glitchmr@pineapple ~]$ echo --help
--help
[glitchmr@pineapple ~]$ which echo
/bin/echo
[glitchmr@pineapple ~]$ /bin/echo --help
Usage: /bin/echo [SHORT-OPTION]... [STRING]...
  or:  /bin/echo LONG-OPTION
Echo the STRING(s) to standard output.

...

NOTE: your shell may have its own version of echo, which usually supersedes
the version described here.  Please refer to your shell's documentation
for details about the options it supports.

Report echo bugs to bug-coreutils@gnu.org
GNU coreutils home page: &amp;lt;http://www.gnu.org/software/coreutils/&amp;gt;
General help using GNU software: &amp;lt;http://www.gnu.org/gethelp/&amp;gt;
Report echo translation bugs to &amp;lt;http://translationproject.org/team/&amp;gt;
For complete documentation, run: info coreutils 'echo invocation'&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;/bin/echo&lt;/code&gt; on my system is GNU echo. The &lt;code&gt;bash&lt;/code&gt; on my system is GNU bash. They were both made by GNU. Yet, they act differently. Is there a better recipe for failure than program that actually isn’t called because your shell is “clever”.&lt;/p&gt;&lt;p&gt;It’s not just &lt;code&gt;echo&lt;/code&gt;. Many commands are implemented in shell, when they should be implemented outside shell. For example, &lt;code&gt;pwd&lt;/code&gt;. Why exactly? To confuse you when dealing with recursive structures.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;[glitchmr@pineapple ~]$ mkdir recursion
[glitchmr@pineapple ~]$ cd recursion/
[glitchmr@pineapple recursion]$ ln -s . recursion
[glitchmr@pineapple recursion]$ cd recursion
[glitchmr@pineapple recursion]$ pwd
/home/glitchmr/recursion/recursion
[glitchmr@pineapple recursion]$ which pwd
/bin/pwd
[glitchmr@pineapple recursion]$ /bin/pwd
/home/glitchmr/recursion
[glitchmr@pineapple recursion]$ &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The shell outright lies about your location. You’re in &lt;code&gt;/home/glitchmr/recursion&lt;/code&gt;. Why shell does that? Well, it does that to not confuse you when typing &lt;code&gt;cd ..&lt;/code&gt;. And indeed, if you type &lt;code&gt;cd recursion/recursion&lt;/code&gt;, and &lt;code&gt;cd ..&lt;/code&gt; after that, you will end in &lt;code&gt;recursion&lt;/code&gt; directory, not the directory where you created the first &lt;code&gt;recursion&lt;/code&gt; directory.&lt;/p&gt;&lt;p&gt;Symbolic links in UNIX are simply redirects. If you made a symbolic link to &lt;code&gt;/usr/share/hell&lt;/code&gt;, you shouldn’t expect that &lt;code&gt;cd ..&lt;/code&gt; made after following link follow return you anywhere that isn’t &lt;code&gt;/usr/share&lt;/code&gt;. Yet, implementation of symbolic links in bash lies.&lt;/p&gt;&lt;p&gt;The lie is obvious after using anything that isn’t bash builtin. For example, &lt;code&gt;ls ..&lt;/code&gt; will always show contents of &lt;code&gt;/usr/share&lt;/code&gt;, even if you made symbolic link in &lt;code&gt;/tmp/heaven&lt;/code&gt;. Yet, &lt;code&gt;cd ..&lt;/code&gt; will return to &lt;code&gt;/tmp/heaven&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;By the way, in case you ask, &lt;code&gt;cd&lt;/code&gt; is also a builtin. But that’s acceptable, because external command cannot change environment of caller (such at PATH). So it has to be a builtin. Yet, somehow, &lt;a href=&quot;http://superuser.com/questions/241129/why-wont-sudo-cd-work&quot; title=&quot;Super User: Why won&quot;&gt;some people are still confused&lt;/a&gt;.&lt;/p&gt; id='z_shell'&amp;gt;Z shell&amp;gt;&lt;p&gt;Z shell is a shell that is way better than bash. Well, if you &lt;em&gt;configure&lt;/em&gt; it properly. It’s a shell that appears to have some compatibility with Bash scripters (for example &lt;code&gt;$''&lt;/code&gt; syntax works, but &lt;code&gt;$&quot;&quot;&lt;/code&gt; doesn’t (or rather, it returns literal ’$’ and contents of &lt;code&gt;&quot;&quot;&lt;/code&gt;)).&lt;/p&gt;&lt;p&gt;Z shell has lots of features. In fact, the author is “not aware of a major interactive feature in any other freely-available shell which zsh does not also have (except smallness)”. Something that would be sane default actually isn’t default. In fact, with default settings it mostly works like &lt;code&gt;bash&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;For example, completion. By default, Z shell only completes file names and command names. If you will type &lt;code&gt;sudo apt-get install&lt;/code&gt;, press space and then press Tab, it will give you file names. Useful? I don’t think so.&lt;/p&gt;&lt;p&gt;Of course, the option to enable better Tab completion is possible to turn on. It’s just not default. Why the shell would have default that don’t make sense. Simiarly, by default Tab completion cannot expand globs. Yet, it’s possible to enable.&lt;/p&gt;&lt;p&gt;When you start Z shell for first time, you see the configuration wizard (called &lt;code&gt;zsh-newuser-install&lt;/code&gt;). The problem is, it’s the most non-user-friendly thing I’ve seen. It asks about minor details you don’t care about, without proposing any useful default. For example, the maximum number of errors you can make for the command to be still proposed in error message. I just have pressed Enter, and the response is “Please enter a number”. Do you think I care about this?&lt;/p&gt;&lt;p&gt;Actually, as far I know, nobody actually uses this wizard. In most cases, zsh is configured using so called &lt;code&gt;oh-my-zsh&lt;/code&gt;. What it is actually? Well, it’s a config script with sane things configured by default. Yet, it has got 8,648 stars on GitHub and 3,326 forks as I’m writing it.&lt;/p&gt;&lt;p&gt;Yes, it’s just ZSH config file that has things that should be default, but they aren’t. Oh, and &lt;code&gt;plugins&lt;/code&gt; array that contains list of plugins that mostly make aliases and completion adders that aren’t in main zsh (like CoffeeScript). For example &lt;code&gt;git&lt;/code&gt; plugin adds aliases like &lt;code&gt;gc&lt;/code&gt; for &lt;code&gt;git commit -v&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;I don’t know about you, but I don’t like programs which take 4 hours to configure. Z shell is one of these. &lt;code&gt;oh-my-zsh&lt;/code&gt; makes the job easier, but I still don’t think it’s worth wasting the time. Perhaps if &lt;code&gt;fish&lt;/code&gt; wouldn’t exist, it would be worth it.&lt;/p&gt; id='friendly_interactive_shell'&amp;gt;friendly interactive shell&amp;gt;&lt;p&gt;Z shell, aside of totally insane configuration isn’t a bad shell (if I would want to talk about bad shells, it would be csh or cmd.exe). friendly interactive shell is as good as Z shell (with good Z shell configuration), except without having to configure it.&lt;/p&gt;&lt;p&gt;In fact, most of things cannot be configured. You cannot configure nonsense like maximal history length (by design). You cannot configure interpretation of numbers starting with 0 as octal (you can in Z shell - I have no idea why Z shell even allows you to type “echo 010” to get “8” when configured to do so - but it does). You cannot disable file globs.&lt;/p&gt;&lt;p&gt;Remember &lt;code&gt;.bashrc&lt;/code&gt;/&lt;code&gt;.zshrc&lt;/code&gt; configuration file? You won’t need it. The colors and themes can be easily configured using a web service (but if you prefer, you can use &lt;code&gt;set&lt;/code&gt; command directly).&lt;/p&gt;&lt;p&gt;For example, if you want to configure your &lt;code&gt;EDITOR&lt;/code&gt; to be &lt;code&gt;vim&lt;/code&gt;, you can run the following command.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;set -Ux EDITOR vim&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;-U&lt;/code&gt; modifier means that this value is stored between session. The &lt;code&gt;-x&lt;/code&gt; means that this variable is exported to programs ran by shell. After you have done that, your variable magically appears in every &lt;code&gt;fish&lt;/code&gt; session.&lt;/p&gt;&lt;p&gt;Adding new functions is also easy. It’s enough to type &lt;code&gt;funced function-name&lt;/code&gt;. After&lt;/p&gt;&lt;p&gt;Fish also offers features I haven’t seen in other shells, like syntax highlighting. Ommited quote? Syntax highlighting will help you.&lt;/p&gt;&lt;p&gt;In fish, everything is tab-completeable. Even if the program doesn’t have specific tab completion definitions, it’s still tab-completeable, thanks to generating tab completions from man pages. For example, &lt;code&gt;gedit&lt;/code&gt; doesn’t have specific tab completions, yet fish managed to create them.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;glitchmr@pineapple ~&amp;gt; gedit -
--background                                         (Run gedit in the background.)
--encoding        (Set the character encoding to be used for openi… [See Man Page])
--geometry                     (Set the X geometry window size (WIDTHxHEIGHT+X+Y).)
--help                                           (Prints the command line options.)
--list-encodings  (Display list of possible values for the encodin… [See Man Page])
--new-document            (Create a new document in an existing instance of gedit.)
--new-window       (Create a new toplevel window in an existing instance of gedit.)
--standalone                                        (Run gedit in standalone mode.)
--version                                    (Output version information and exit.)
--wait                                    (Open files and block the gedit process.)
-b                                                   (Run gedit in the background.)
-g                             (Set the X geometry window size (WIDTHxHEIGHT+X+Y).)
-s                                                  (Run gedit in standalone mode.)
-w                                        (Open files and block the gedit process.)&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Of course, just like zsh (with correct configuration), it can expand more stuff. For example, kill command expands process IDs.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;glitchmr@pineapple ~&amp;gt; kill 
1            (systemd)  127           (systemd-udevd)  479                (gconfd-2)
2           (kthreadd)  132         (systemd-journal)  508                   (gvfsd)
3        (ksoftirqd/0)  229               (hd-audio0)  512              (gvfsd-fuse)
5       (kworker/0:0H)  230               (kpsmoused)  527         (cinnamon [tty1])
7       (kworker/u:0H)  299              (irq/46-mei)  528                  (colord)
8        (migration/0)  307                (cfg80211)  534  (polkit-gnome-au [tty1])
9        (rcu_preempt)  308                    (hci0)  536          (dropbox [tty1])
10            (rcu_bh)  309            (kworker/u:1H)  539        (nm-applet [tty1])
11         (rcu_sched)  310               (scsi_eh_6)  540  (gnome-screensav [tty1])
12        (watchdog/0)  311         (rts5139-control)  558      (gsd-printer [tty1])
13        (watchdog/1)  312         (rts5139-polling)  566         (gvfs-udisks2-vo)
14       (ksoftirqd/1)  314                (ttm_swap)  568                 (udisksd)
15       (migration/1)  325          (NetworkManager)  598             (gvfsd-trash)
17      (kworker/1:0H)  329             (dbus-daemon)  728          (firefox [tty1])
18            (cpuset)  331          (systemd-logind)  744          (hexchat [tty1])
19           (khelper)  332                   (login)  746      (pxgsettings [tty1])
20         (kdevtmpfs)  335                 (polkitd)  797           (dconf-service)
21             (netns)  341                  (mysqld)  798   (gnome-terminal [tty1])
22       (bdi-default)  344          (wpa_supplicant)  805  (gnome-pty-helpe [tty1])
23           (kblockd)  348                   (nginx)  806            (fish [pts/0])
26        (khungtaskd)  349                   (nginx)  1374            (kworker/1:2)
27           (kswapd0)  351                 (php-fpm)  5790           (fish [pts/1])
28              (ksmd)  352                 (php-fpm)  10502        (gvfsd-metadata)
29        (khugepaged)  353                 (php-fpm)  13551          (fish [pts/2])
30     (fsnotify_mark)  373                (dhclient)  13635           (ssh [pts/2])
31            (crypto)  385             (fish [tty1])  13866           (kworker/1:0)
35          (kthrotld)  387                   (fishd)  18892            (gvfsd-http)
38           (deferwq)  412           (startx [tty1])  20044          (fish [pts/1])
62             (khubd)  429            (xinit [tty1])  20046        (python [pts/1])
63           (ata_sff)  430                       (X)  20405           (vim [pts/0])
64         (scsi_eh_0)  434    (gnome-session [tty1])  21370           (kworker/0:1)
65         (scsi_eh_1)  437      (dbus-launch [tty1])  21373           (kworker/u:2)
66         (scsi_eh_2)  438             (dbus-daemon)  22399          (fish [pts/3])
67         (scsi_eh_3)  440         (at-spi-bus-laun)  22472           (vim [pts/3])
68         (scsi_eh_4)  444             (dbus-daemon)  22521           (kworker/u:0)
69         (scsi_eh_5)  447         (at-spi2-registr)  22863           (kworker/0:0)
93      (kworker/0:1H)  455  (gnome-settings- [tty1])  22945           (kworker/u:1)
95      (kworker/1:1H)  464              (pulseaudio)  23238            (ps [pts/4])
103      (jbd2/sda6-8)  465            (rtkit-daemon)  23239          (grep [pts/4])
104  (ext4-dio-unwrit)  468                 (upowerd)  23240          (tail [pts/4])
110        (flush-8:0)  476            (gconf-helper)&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Of course, fish has some disadvantages. One of disadvantages is the syntax. It’s not POSIX compatible by design. For example, the history substition doesn’t exist. Instead, you’re supposed (if you wanted, let’s say, sudo) to press Up, Home, and type ‘sudo’. Command substitution uses &lt;code&gt;()&lt;/code&gt;, not &lt;code&gt;``&lt;/code&gt; or &lt;code&gt;$()&lt;/code&gt;. Still, if you will accidentally use &lt;code&gt;$()&lt;/code&gt; bashism, the shell will inform you with an error.&lt;/p&gt;&lt;p&gt;Also, the newest stable is really old and slow. Instead I would use version from git, which is usually more stable than stable version. In Arch Linux, it’s &lt;code&gt;fish-shell-git&lt;/code&gt; from AUR, on other operating systems (like CentOS I use on my VPS), you have to compile it yourself. It isn’t so difficult. The GitHub repository is &lt;a href=&quot;https://github.com/fish-shell/fish-shell/&quot; title=&quot;GitHub: fish-shell/fish-shell&quot;&gt;fish-shell/fish-shell&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;As for why I’m mentioning fish shell, well, I have lately contributed a small patch to &lt;a href=&quot;https://github.com/fish-shell/fish-shell/commit/a61e2caadb532ddbe73b85fd539c58c173e9f051&quot; title=&quot;GitHub: fish-shell/fish-shell - Update Perl completion&quot;&gt;hint -C suboptions in perl&lt;/a&gt; - like &lt;code&gt;-CSDL&lt;/code&gt;. Nothing special, but hey, why not make a blog post, considering I write them rarely.&lt;/p&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Parrot 5.1.0 &quot;Zombie Parrot&quot; Released! by Bruce Gray</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2013/02/msg691.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2013/02/msg691.html</id>
		<updated>2013-02-20T18:36:17+00:00</updated>
		<content type="html">Flat on the bunk again, he ran for his life. The Parrot stalked him&lt;br /&gt;	through the grey hours of morning, smoothing its fractal feathers,&lt;br /&gt;	shuffling itself slowly into clarity as though at the end of a&lt;br /&gt;	flashy film-dissolve, until at last his mind's eye had to acknowledge&lt;br /&gt;	a shape,&lt;br /&gt;		a shape,&lt;br /&gt;			a wink&lt;br /&gt;-- From BLIT, a short story by David Langford&lt;br /&gt;	http://www.infinityplus.co.uk/stories/blit.htm&lt;br /&gt;&lt;br /&gt;On behalf of the Parrot team, I'm proud to announce Parrot 5.1.0, also known&lt;br /&gt;as &quot;Zombie 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 5.1.0 is available on Parrot's FTP site&lt;br /&gt;(ftp://ftp.parrot.org/pub/parrot/releases/supported/5.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 5.1.0 News:&lt;br /&gt;   - Core&lt;br /&gt;       + The .sort() method was added to the FixedFloatArray PMC&lt;br /&gt;       + Improved detection of system memory for machines with &amp;gt;2GB&lt;br /&gt;       + Improved pbc_to_exe support for spacey paths&lt;br /&gt;       + Fixed Parrot_io_readall_s allocating too much string space&lt;br /&gt;   - Build&lt;br /&gt;       + Fixed generated MANIFEST files to omit $destdir&lt;br /&gt;   - Documentation&lt;br /&gt;   - Tests&lt;br /&gt;       + .readall now checks that prior reads are respected.&lt;br /&gt;   - Community&lt;br /&gt;       + Weekly IRC meetings have resumed. #parrotsketch Tuesdays at 1930 UTC&lt;br /&gt;&lt;br /&gt;The SHA256 message digests for the downloadable tarballs are:&lt;br /&gt;af26c2fcc806505ec516ebb013bdd37b218633f5fe63faaa6b843ffe55e0135e parrot-5.1.0.tar.bz2&lt;br /&gt;2483963c1bec665be772cb40a71fd3d9d2621feca547932475017c81a2f7e49b parrot-5.1.0.tar.gz&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 19 Mar 2013.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;br /&gt;-- &lt;br /&gt;Bruce Gray (Util of PerlMonks)&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-2013 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">NQP on JVM gets Grammars, Multiple Dispatch</title>
		<link href="http://6guts.wordpress.com/2013/02/17/nqp-on-jvm-gets-grammars-multiple-dispatch/"/>
		<id>http://6guts.wordpress.com/?p=267</id>
		<updated>2013-02-16T23:16:22+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Having just reached an interesting milestone, I thought I’d blog a quick progress update on my work to port NQP to the JVM, in preparation for also doing a port of Rakudo Perl 6.&lt;/p&gt;
&lt;p&gt;The big news is that the grammar and regex engine is pretty much ported. This was a sizable and interesting task, and while a few loose ends need to be wrapped up I think it’s fair to say that the hard bits are done. The port includes support for the basics (literals, quantifiers, character classes, positional and named captures, calls to other rules, and so forth) as well as the more advanced features (transitive Longest Token Matching for both alternations and protoregexes, and embedded code blocks and assertions). Missing are anchors, conjunctions and a small number of built-in rules; none of these are particularly demanding or require primitives that don’t already exist, however. It’s also worth pointing out that the NQP code to calculate the NFAs used in Longest Token Matching also runs just fine atop of the JVM.&lt;/p&gt;
&lt;p&gt;Another interesting feature that I ported a little while ago is multiple dispatch. This was some effort to port, since the original implementation had been done in C. While it’s sensible to have a close-to-the-VM dispatch cache, there’s little reason for the one-off candidate sorting work (not a hot path) to be done in C, so I ported the code for this to NQP. This meant that on the JVM side, I just needed to implement a few extra primitives, and could then run the exact same candidate sorting code.&lt;/p&gt;
&lt;p&gt;I think it’s worth noting again that I’m really doing two things in parallel here: hunting down places where NQP couples too tightly to Parrot and loosening the coupling, and also doing the porting to the JVM. The first half of this work is relevant to all future ports. In many cases, I’m also finding that the changes give us architectural improvements or just cleaner, more maintainable code. I wanted to point this out especially because I’m seeing various comments popping up suggesting that Rakudo (or even Perl 6) is on a one-way road to the JVM, forsaking all other platforms. That’s not the case. The JVM has both strengths (mature, a solid threading story, widely deployed, the only allowed deployment platform in some development shops, increasing attention to supporting non-Java languages through things like invokedynamic) as well as weaknesses (slow startup time, lack of native co-routine support, and the fact that it was originally aimed at static languages). Rakudo most certainly should run on JVM – and it most certainly should run on other platforms too. And, as I wrote in my previous post, we’ve designed things so that we are able to do so. Perl has always been a language where There’s More Than One Way To Do It. Perl also has a history of running on a very wide range of platforms. Perl 6 should continue down this track – but the new reality is that a bunch of the interesting platforms are virtual, not hardware/OS ones.&lt;/p&gt;
&lt;p&gt;By now, the JVM porting work is fast approaching a turning point. Up until now, it’s been about getting a cross-compiler and runtime support in place and working our way through the NQP test suite. This phase is largely over. The next phase is about getting NQP itself cross-compiled – that is, cross-compiling the compiler, so that we have an NQP compiler that runs on the JVM, supporting eval and able to run independently.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/267/&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/267/&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=267&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">Perl 6 is now half as old as Perl</title>
		<link href="http://strangelyconsistent.org/blog/perl6-is-now-half-as-old-as-perl"/>
		<id>tag:strangelyconsistent.org,2013-02-16:blog/perl6-is-now-half-as-old-as-perl</id>
		<updated>2013-02-16T18:00:54+00:00</updated>
		<content type="html">&lt;p&gt;Today Perl 6 is as old as Perl was when Perl 6 was announced.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ perl6 -e 'say Date.new(2000, 7, 18) + (Date.new(2000, 7, 18) - Date.new(1987, 12, 18))'
2013-02-16
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The 1987 date is the release of Perl 1. The 2000 date is the &lt;a href=&quot;http://strangelyconsistent.org/blog/happy-10th-anniversary-perl-6&quot;&gt;throwing of the mugs&lt;/a&gt;, which I consider to be Perl 6's birthday.&lt;/p&gt;

&lt;p&gt;It's a bit interesting to compare Perl 6 at this point with Perl back then. They are two fairly different projects, even though the people are overlapping to a great extent.&lt;/p&gt;

&lt;h2&gt;Bottom-up vs top-down&lt;/h2&gt;

&lt;p&gt;In any programming project, you can start from the small pieces and build upwards to the overreaching goals and ideas, or you can start from the ideas and build downwards to the nitty-gritty stuff.&lt;/p&gt;

&lt;p&gt;Perl is a bottom-up project: the Perl 1 release looks puny today. It didn't do much. But it did run. It did solve people's problems. And there's an unbroken chain of commits leading from Perl 1 to today's Perl 5.&lt;/p&gt;

&lt;p&gt;Perl 6 is definitely a top-down project. Larry mulled over those RFC's and wrote the Apocalypses. These eventually resulted in the Synopses, which guide implementation work. Implementations reach up towards the spec, and are in some sense always built bottom-up... but on the most zoomed-out scale, Perl 6 is built from the top down.&lt;/p&gt;

&lt;p&gt;This difference was very much deliberate. For the Perl 6 project, it was felt that a specification (and a corresponding test suite) was needed. The Pugs project is currently very dormant and not actively developed, but it &lt;em&gt;did&lt;/em&gt; result in both the Synopses and the spectest suite. Both are essential artifacts for any Perl 6 implementer.&lt;/p&gt;

&lt;h2&gt;Second system syndrome&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;&quot;It's important to remember that when you start from scratch there is &lt;strong&gt;absolutely no reason&lt;/strong&gt; to believe that you are going to do a better job than you did the first time.&quot; — Joel Spolsky, &lt;a href=&quot;http://www.joelonsoftware.com/articles/fog0000000069.html&quot;&gt;Things You Should Never Do, Part I&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Look, here's the thing: everyone knows that The Big Rewrite isn't a good idea. That's like, Software Project Management 101. Even the people going into this project knew that. The &lt;a href=&quot;http://www.zazzle.com/camelia_second_system_tote_bag-149004096878338512&quot;&gt;jokes about second systems&lt;/a&gt; have been with us from the start, as a part of our cultural heritage.&lt;/p&gt;

&lt;p&gt;There have been efforts to mitigate the risks and to calm people on the way. The Ponie project was an effort to put Perl 5 on Parrot, for example, to provide for a migration path or simply a communication bridge from Perl 5 to Perl 6.&lt;/p&gt;

&lt;p&gt;Early on, it was also felt that Perl 6 wouldn't be so different from Perl 5, syntactically. Sure, the sigils would come out being invariant, and a comma would have to be added here and there for consistency. But that was about it. Perl 5 programmers would still feel right at home.&lt;/p&gt;

&lt;p&gt;Well, guess what? The Ponie project, even with brilliant developers behind it, slowed and finally halted at the height of the Pugs era. Turns out the reasons people wanted to further themselves from the existing Perl 5 internals — that they are a big hairy mess of intertwined C macros — also made porting to Parrot exceedingly difficult. Ponie brought some permanent improvements to the Perl 5 core, but in the end it didn't reach its goal of Perl 5 targeting Parrot.&lt;/p&gt;

&lt;p&gt;In the meantime, Perl 6 kept improving and evolving, syntactically as well as semantically. The differences piled up. Perl 6, unfettered by backward-compatibility, could take sometimes vast leaps and reach places in the state-space Perl 5 could only dream of. Also, things kept shaking around and stabilizing, features growing together into a unified whole instead of &lt;a href=&quot;http://perl-begin.org/humour/perl6_perl_6_cover_lg.jpg&quot;&gt;this&lt;/a&gt;. All good and well, but it meant that Perl 6 drifted further away from Perl 5.&lt;/p&gt;

&lt;p&gt;So here we are, a decade later, with two distinct languages, and no way for them to interoperate. Having them actually talk to each other is still very much on the agenda. It's just that it's a big undertaking. A couple of recent projects are attempting to put Perl 5 on a platform where it can talk to Perl 6.&lt;/p&gt;

&lt;p&gt;I think the biggest thing to realize in all this is that Perl 6, even from the very start, could never have followed the trajectory Perl did. There was one thing that existed in 2000 that didn't exist in 1987, when Perl was announced: Perl. &lt;em&gt;That's&lt;/em&gt; why Perl 6 is a top-down project. &lt;em&gt;That's&lt;/em&gt; why it's a second system. And &lt;em&gt;that's&lt;/em&gt; why the obvious measure-stick of Perl 6 is Perl, with its 13-year head start.&lt;/p&gt;

&lt;h2&gt;Rubber, meet road&lt;/h2&gt;

&lt;p&gt;I'm not complaining about this, mind. We &lt;em&gt;should&lt;/em&gt; compare Perl 6 to Perl. And to all other scripting languages that have popped up in the same niche. We should steal ideas and adapt to modern practices, like we always do, in both Perl and Perl 6.&lt;/p&gt;

&lt;p&gt;But for a top-down project, the biggest challenge is always to reach all the way down to the ground: to actually start being useful for someone. That's perhaps our big challenge. It was back in 2008 when I became heavily involved in the Perl 6 effort, and it still is today: be useful. Be usable. &lt;a href=&quot;http://www.youtube.com/watch?v=GRfhTBmw9Y8&quot;&gt;Put food on someone's family&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Perl 6 is useful to me today. Not to the extent that I can write Perl 6 code all day, but to the extent that it makes me more effective and more productive now and then. Bringing that kind of usefulness to others requires lots of work writing modules, documentation, books, and tutorials, as has been discussed elsewhere. We're making some headway with this. I'm more optimistic than I was two years ago.&lt;/p&gt;

&lt;p&gt;We also need to work on things such as performance. Perl 6 is fast enough for some things, but overall implementations are still fairly slow. Sometimes ridiculously slow. Good work is being done in this area, too.&lt;/p&gt;

&lt;p&gt;But here's what makes me the most optimistic about the Perl 6 effort: after a few years of watching things evolve, I've noticed that while Perl 6 is being developed top-down on the outermost scale, it's actually a series of bottom-up projects that drive Perl 6 forwards.&lt;/p&gt;

&lt;p&gt;jnthn likes to tell about how he promised to implement junctions in Rakudo back in 2008, and then realized that junctions were actually tied to method dispatch and the object system, so he had to implement those, too. Later, while pmichaud was rebuilding the parser according to our current understanding of it, jnthn was building Rakudo's meta-object protocol, a project called 6model. Each step on the way replacing the layer below based on what we had found that the layer above required. The 6model work is part of what now enables us to port nqp and Rakudo to the JVM.&lt;/p&gt;

&lt;p&gt;That's what makes me optimistic. While Perl 6 is undeniably, unchangeably a top-down project, highly competent people are factoring that top-down knowledge into the design of components in a bottom-up way. What's been happening in these 13 years is that we've become increasingly better and more efficient at building Perl 6.&lt;/p&gt;

&lt;h2&gt;So, how're we doing?&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;&quot;Chuck Norris has actually been using Perl 6 since 1987, and has been waiting for Larry to play catch-up. :)&quot; — dukeleto on #perl6&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's stop and compare the state of Perl 6 today with the state of Perl back in 2000.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mugs&lt;/strong&gt;. Back then, Jon Orwant threw coffee mugs against a wall because he felt there was nothing to energize the community and people would walk off to other things.&lt;/p&gt;

&lt;p&gt;Are sixers doing any mug-throwing nowadays? Yup, we did, at the Perl Reunification Summit. Liz felt, and still feels, that if we don't actively bring Perl 5 and Perl 6 together, then both projects are eventually going to fizzle out.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Crisis&lt;/strong&gt;. As part of that, the feeling Jon Orwant was expressing was that Perl was stagnating or going nowhere.&lt;/p&gt;

&lt;p&gt;Is Perl 6 stagnating? I wouldn't say so. We're still extremely small compared to Perl 5, but my general sense is that we're still &lt;em&gt;gaining&lt;/em&gt; speed, becoming stronger every day. Still very much pre-peak.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Usefulness&lt;/strong&gt;. In 2000, Perl was on its thirteenth year of solving everyday problems for people.&lt;/p&gt;

&lt;p&gt;What about Perl 6 today? Well, it's very different. Part of this is due to the top-down nature of the project. People are waiting for it to be useful to them. Part of it is &lt;em&gt;perception&lt;/em&gt;: people are &lt;em&gt;waiting&lt;/em&gt;, instead of jumping in and using the language in cases where it could already be useful to them. We see this in the verb tenses people are using when they ask stuff: &quot;Will Perl 6...&quot; Perl 6 is about the future, but if we don't do something about that perception, we'll never get there. The problem with &quot;tomorrow&quot; is that it never actually arrives.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Community&lt;/strong&gt;. In 2000, Perl drew thousands of people to conferences each year.&lt;/p&gt;

&lt;p&gt;Is Perl 6 drawing thousands? No. The Perl people are kind enough to let us piggyback on Perl conferences and workshops, and through them we have an audience of thousands. I keep feeling that there's a big interest in Perl 6, both from within the Perl community and from other communities. But there's also a sense of waiting, of not-yet-production-ready. (And I agree.)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;What remains?&lt;/h2&gt;

&lt;p&gt;Which brings us to the last, perhaps most important question. What's left for Perl 6 to become a viable, useful solution to most people out there?&lt;/p&gt;

&lt;p&gt;For years I wouldn't go near that question. Just working along, head looking down at the current sub-projects, making Perl 6 more useful to myself and hoping that was enough. But my recent visit to FOSDEM made me realize that some kind of production release is actually within reach — say, a few years away — and a focused effort to reach a releasable state by some criteria would be highly useful for us and for others.&lt;/p&gt;

&lt;p&gt;So here are my for criteria. This is what Perl 6 needs to be ready for the world.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;. Slightly simplified, this is what we've been working on since the Pugs days. &lt;a href=&quot;http://perl6.org/compilers/features&quot;&gt;We are doing well&lt;/a&gt; on features. There's not much I feel is missing nowadays from the core language. It's a pleasant language to use and to express thoughts in. There are bugs, sure, but with each month that passes, those bugs are becoming less frequent and less serious.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Speed&lt;/strong&gt;. Working on it. I won't make any promises about the JVM port, but I have a strong feeling it will make a big difference. Parallel to this, there are various already-implemented or to-be-implemented efforts to make the compiler smarter about generating efficient code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Concurrency&lt;/strong&gt;. There are some good ideas in the specification about concurrency. Some of them will work fine, some probably won't pan out. What's needed now is a solid implementation of concurrency in either Rakudo or Niecza, a test-bed for the ideas in the spec, so that users can get a feel for what's there and what's missing. I'd really like for Perl 6 to have a decent concurrency story, because it's one of the things that were promised early on for Perl 6, and one of the things that Perl never got right. Also, concurrency in all its various forms seems to be growing increasingly important in the programming world of today.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CPAN&lt;/strong&gt;. Sure, we have &lt;a href=&quot;http://modules.perl6.org/&quot;&gt;an ecosystem&lt;/a&gt; for Perl 6. But it isn't CPAN. It's three orders of magnitude as small as CPAN. And it's not realistic to port all of CPAN either — that'll simply never happen. What we really need is a high-bandwidth connection between Perl 5 and Perl 6. We need for them to run in the same runloop. Once they do that, Perl 6 programmers can have their CPAN modules, and Perl 5 programmers can work Perl 6 code into their projects. This is also something that was promised early on. It's not an easy task.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Perl 6 is a multi-year project. Though today's date is a little bit arbitrary, it's worthwhile to look both backwards and forwards, to see where we currently are. And though we're structurally different from the Perl project, it's still interesting to make comparisons.&lt;/p&gt;

&lt;p&gt;We believe we're building something really nice with Perl 6. 2013 may not be the year when we're finally production-ready, but it sure feels like a year where a lot of significant things will happen (and are already happening). And, unlike 2012, I finally feel ready to speculate about the light at the end of the tunnel.&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">Perl 6 changes - 2013W07</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W07.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W07.html</id>
		<updated>2013-02-16T08:00:00+00:00</updated>
		<content type="html">&lt;pre&gt;&lt;code&gt;&amp;gt; my $perl = Date.new: '1987-12-18' # Perl 1 release&lt;sup&gt;&lt;a href=&quot;http://perldoc.perl.org/perlhist.html&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;
1987-12-18
&amp;gt; my $perl6 = Date.new: '2000-07-18' # Perl 6 announcement&lt;sup&gt;&lt;a href=&quot;http://strangelyconsistent.org/blog/happy-10th-anniversary-perl-6&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;
2000-07-18
&amp;gt; Date.today - $perl6
4596
&amp;gt; $perl6 - $perl
4596&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Normally, I wouldn’t put irrelevant snippets of code&lt;sup&gt;[citation
needed]&lt;/sup&gt;. But this day is different - we have Perl 6 equidieversary (thanks, &lt;a href=&quot;http://www.perlgeek.de/&quot; title=&quot;Perlgeek.de&quot;&gt;moritz&lt;/a&gt;). It’s 4596 days since Perl 6 was announced (Wikipedia says it was annouced 2000-07-19, but actually it was earlier). In 2000-07-19, Perl was 4596 days old. But I won’t discuss about this more, as &lt;a href=&quot;http://strangelyconsistent.org/blog/perl6-is-now-half-as-old-as-perl&quot; title=&quot;Strangely Consistent: Perl 6 is now half as old as Perl&quot;&gt;masak already made perfectly fine article about that&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Let’s return to your regularly scheduled program.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Set&lt;/code&gt;s and &lt;code&gt;Bag&lt;/code&gt;s do not flatten in list context.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Metaoperators are treated as normal operators, and aren’t making list of closures. So, for example &lt;code&gt;@array X* *&lt;/code&gt; is &lt;code&gt;-&amp;gt; $arg { @array X* $arg }.&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Inner classes and roles must be lexically scoped.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Added &lt;code&gt;List.combinations&lt;/code&gt; and &lt;code&gt;Set.combinations&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Added &lt;code&gt;Set.powerset&lt;/code&gt;. It’s defined like that.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;multi method powerset { set ∅, self.combinations }&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$_&lt;/code&gt; is writable in &lt;code&gt;-n&lt;/code&gt;/&lt;code&gt;-p&lt;/code&gt; code (one-liner).&lt;/li&gt;

&lt;li&gt;&lt;code&gt;eqv&lt;/code&gt; is faster for &lt;code&gt;Buf&lt;/code&gt; objects.&lt;/li&gt;

&lt;li&gt;Configure script fails on unknown command line options.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Pattern Matching and Unpacking</title>
		<link href="http://perlgeek.de/blog-en/perl-6/2013-pattern-matching.html"/>
		<id>http://perlgeek.de/blog-en/perl-6/2013-pattern-matching.html</id>
		<updated>2013-02-13T05:49:13+00:00</updated>
		<content type="html">&lt;p&gt;When talking about &lt;em&gt;pattern matching&lt;/em&gt; in the context of Perl 6,
people usually think about regex or grammars. Those are indeed very powerful
tools for pattern matching, but not the only one.&lt;/p&gt;

&lt;p&gt;Another powerful tool for pattern matching and for unpacking data
structures uses signatures.&lt;/p&gt;

&lt;p&gt;Signatures are &quot;just&quot; argument lists:&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; repeat(&lt;span class=&quot;synType&quot;&gt;Str&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$s&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; Int &lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;$count&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt; &lt;/span&gt;{
    &lt;span class=&quot;synComment&quot;&gt;#     ^^^^^^^^^^^^^^^^^^^^  the signature&lt;/span&gt;
    &lt;span class=&quot;synComment&quot;&gt;# $s and $count are the parameters&lt;/span&gt;
    &lt;span class=&quot;synSpecial&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$s&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$count&lt;/span&gt;
}
&lt;/pre&gt;

&lt;p&gt;Nearly all modern programming languages have signatures, so you might say:
nothing special, move along. But there are two features that make them more useful
than signatures in other languages.&lt;/p&gt;

&lt;p&gt;The first is &lt;em&gt;multi dispatch&lt;/em&gt;, which allows you to write several
routines with the name, but with different signatures. While extremely
powerful and helpful, I don't want to dwell on them. Look at Chapter 6 of
the &lt;a href=&quot;https://github.com/downloads/perl6/book/2012.05.23.a4.pdf&quot;&gt;&quot;Using
Perl 6&quot; book&lt;/a&gt; for more details.&lt;/p&gt;

&lt;p&gt;The second feature is &lt;em&gt;sub-signatures&lt;/em&gt;. It allows you to write a
signature for a sigle parameter.&lt;/p&gt;

&lt;p&gt;Which sounds pretty boring at first, but for example it
allows you to do declarative validation of data structures. Perl 6 has no
built-in type for an array where each slot must be of a specific but different
type. But you can still check for that in a sub-signature&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; f(&lt;span class=&quot;synIdentifier&quot;&gt;@array&lt;/span&gt; [&lt;span class=&quot;synType&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synType&quot;&gt;Str&lt;/span&gt;]) {
    &lt;span class=&quot;synIdentifier&quot;&gt;say&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;@array&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;join&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;, &lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
}
f [&lt;span class=&quot;synConstant&quot;&gt;42&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;str&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;synComment&quot;&gt;# 42, str&lt;/span&gt;
f [&lt;span class=&quot;synConstant&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;23&lt;/span&gt;]&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;         &lt;span class=&quot;synComment&quot;&gt;# Nominal type check failed for parameter '';&lt;/span&gt;
                    &lt;span class=&quot;synComment&quot;&gt;# expected Str but got Int instead in sub-signature&lt;/span&gt;
                    &lt;span class=&quot;synComment&quot;&gt;# of parameter @array&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Here we have a parameter called &lt;code&gt;@array&lt;/code&gt;, and it is followed by
a square brackets, which introduce a sub-signature for an array. When calling
the function, the array is checked against the signature &lt;code&gt;(Int,
Str)&lt;/code&gt;, and so if the array doesn't contain of exactly one Int and one
Str in this order, a type error is thrown.&lt;/p&gt;

&lt;p&gt;The same mechanism can be used not only for validation, but also for
&lt;em&gt;unpacking&lt;/em&gt;, which means extracting some parts of the data structure.
This simply works by using variables in the inner signature:&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; head(&lt;span class=&quot;synStatement&quot;&gt;*&lt;/span&gt;@ [&lt;span class=&quot;synIdentifier&quot;&gt;$head&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;$head&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
}
&lt;span class=&quot;synStatement&quot;&gt;sub&lt;/span&gt; tail(&lt;span class=&quot;synStatement&quot;&gt;*&lt;/span&gt;@ [&lt;span class=&quot;synIdentifier&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;@tail&lt;/span&gt;]) {
    &lt;span class=&quot;synIdentifier&quot;&gt;@tail&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
}
&lt;span class=&quot;synIdentifier&quot;&gt;say&lt;/span&gt; head &lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;a b c &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;synComment&quot;&gt;# a&lt;/span&gt;
&lt;span class=&quot;synIdentifier&quot;&gt;say&lt;/span&gt; tail &lt;span class=&quot;synSpecial&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;a b c &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;synComment&quot;&gt;# b c&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Here the outer parameter is anonymous (the &lt;code&gt;@&lt;/code&gt;), though it's
entirely possible to use variables for both the inner and the outer
parameter.&lt;/p&gt;

&lt;p&gt;The anonymous parameter can even be omitted, and you can write &lt;code&gt;sub
tail( [$, *@tail] )&lt;/code&gt; directly.&lt;/p&gt;

&lt;p&gt;Sub-signatures are not limited to arrays. For working on arbitrary objects,
you surround them with parenthesis instead of brackets, and use named
parameters inside:&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;synStatement&quot;&gt;multi&lt;/span&gt; key-type ($ (Numeric &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;$key&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;&quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&quot;&lt;/span&gt; }
&lt;span class=&quot;synStatement&quot;&gt;multi&lt;/span&gt; key-type ($ (&lt;span class=&quot;synType&quot;&gt;Str&lt;/span&gt;     &lt;span class=&quot;synStatement&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;$key&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;&quot;&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;&quot;&lt;/span&gt; }
&lt;span class=&quot;synStatement&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;synConstant&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;synConstant&quot;&gt;a&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;b&lt;/span&gt;&lt;span class=&quot;synSpecial&quot;&gt;'&lt;/span&gt; &lt;span class=&quot;synStatement&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;synConstant&quot;&gt;42&lt;/span&gt;) &lt;span class=&quot;synStatement&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;synIdentifier&quot;&gt;$pair&lt;/span&gt; {
    &lt;span class=&quot;synIdentifier&quot;&gt;say&lt;/span&gt; key-type &lt;span class=&quot;synIdentifier&quot;&gt;$pair&lt;/span&gt;&lt;span class=&quot;synStatement&quot;&gt;;&lt;/span&gt;
}
&lt;span class=&quot;synComment&quot;&gt;# Output:&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# Number&lt;/span&gt;
&lt;span class=&quot;synComment&quot;&gt;# String&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;This works because the &lt;code&gt;=&amp;gt;&lt;/code&gt; constructs a &lt;a href=&quot;http://doc.perl6.org/type/Pair&quot;&gt;Pair&lt;/a&gt;, which has a
&lt;code&gt;key&lt;/code&gt; and a &lt;code&gt;value&lt;/code&gt; attribute. The named parameter
&lt;code&gt;:$key&lt;/code&gt; in the sub-signature extracts the attribute
&lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can build quite impressive things with this feature, for example &lt;a href=&quot;http://rosettacode.org/wiki/Pattern_matching#Perl_6&quot;&gt;red-black tree
balancing based on multi dispatch and signature unpacking&lt;/a&gt;. (&lt;a href=&quot;http://blogs.perl.org/users/ovid/2013/02/red-black-trees-in-perl-6-explained.html&quot;&gt;More verbose explanation of the code&lt;/a&gt;.) Most use
cases aren't this impressive, but still it is very useful to have
occasionally. Like for &lt;a href=&quot;https://gist.github.com/masak/ca5a82ae76951cc387cc&quot;&gt;this small
evaluator.&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">Perl 6 changes - 2013W06</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W06.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W06.html</id>
		<updated>2013-02-09T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;This time without any gimmicks (like five word sentences). This will be simple description of changes I do regularly.&lt;/p&gt; id='new_features_this_time_without_building_stuff_part'&amp;gt;New features (this time without building stuff part)&amp;gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Constant folded &lt;code&gt;^..^&lt;/code&gt; (infix) and &lt;code&gt;^&lt;/code&gt; (prefix) operators.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Added (borrowed from Rakudo Perl) the &lt;code&gt;Match.gist&lt;/code&gt; method.&lt;/li&gt;

&lt;li&gt;Replaced “Unhandle conext character” error with “Unhandle con&lt;strong&gt;t&lt;/strong&gt;ext character” error.&lt;/li&gt;

&lt;li&gt;Added Cool.set method. It can be used to convert argument to set.&lt;/li&gt;

&lt;li&gt;Added Cool.bag. Just like method above, it can be used to convert argument to bag.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">I have Twitter account</title>
		<link href="http://glitchmr.github.com/i-have-twitter-account.html"/>
		<id>http://glitchmr.github.com/i-have-twitter-account.html</id>
		<updated>2013-02-06T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Yet another ignorable self promotion. &lt;a href=&quot;http://twitter.com/GlitchMr&quot; title=&quot;Twitter: GlitchMr&quot;&gt;http://twitter.com/GlitchMr&lt;/a&gt;&lt;/p&gt;&lt;p&gt;(perhaps I should have different news feed for Planet Six…)&lt;/p&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes article - 2013W05</title>
		<link href="http://glitchmr.github.com/perl-6-changes-article-2013W05.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-article-2013W05.html</id>
		<updated>2013-02-02T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;The changes are so fun. jnthn is working on porting. nqp will be on JVM. And then, Rakudo will be. Java is very, very fast. There are some interesting problems. But nothing impossible to solve. At least, I hope so. I would continue, but well. This is not the topic. This is article about changes. Changes in Perl 6, obviously. If you want, enjoy reading.&lt;/p&gt;&lt;p&gt;Rakudo Star 2013.01 was released. It’s based on Rakudo 2013.01. Those changes aren’t in.&lt;/p&gt;&lt;p&gt;On sidenote, a small note. Five word sentences are interesting. I am not stealing ideas. Well, actually, I am now. I should stop talking now.&lt;/p&gt; id='new_features_to_build_stuff'&amp;gt;New features to build stuff&amp;gt;&lt;h2 id=&quot;rakudo_a_perl_6_distribution&quot;&gt;Rakudo, a Perl 6 distribution&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;any&lt;/code&gt; and &lt;code&gt;all&lt;/code&gt; are optimized. To be exact, in statements. The &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;while&lt;/code&gt; statements. And opposites - &lt;code&gt;unless&lt;/code&gt; and &lt;code&gt;until&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Many operators are pure now. That means they are sideeffect-free.&lt;/li&gt;

&lt;li&gt;Site libraries are loaded first.&lt;/li&gt;

&lt;li&gt;Pure subroutines are constant folded.&lt;/li&gt;

&lt;li&gt;REPL supports natively typed variables.&lt;/li&gt;

&lt;li&gt;REPL has better error reporting.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">A look at the preparations behind the JVM port, and a progress update</title>
		<link href="http://6guts.wordpress.com/2013/02/02/a-look-at-the-preparations-behind-the-jvm-port-and-a-progress-update/"/>
		<id>http://6guts.wordpress.com/?p=263</id>
		<updated>2013-02-01T23:49:17+00:00</updated>
		<content type="html" xml:lang="en">&lt;div lang=&quot;x-western&quot;&gt;
&lt;p&gt;After my last post giving a status update on the JVM porting of NQP and the compiler toolchain Rakudo builds upon, hercynium++ left a comment suggesting that I also blog about the design work behind this effort. I liked the idea, and in this post I’ll attempt to describe it a bit. I can’t possibly capture all of the interesting things in a single post, so if this doesn’t cover aspects that are particularly interesting to anybody reading, let me know and I’ll try and find time to write something on them. :-)&lt;/p&gt;
&lt;h3&gt;It started long ago…&lt;/h3&gt;
&lt;p&gt;The first commit to the repository where I’m doing the initial porting work to the JVM may have been back in November, but that isn’t where the journey really started. We’ve known for multiple years now that we would want Rakudo and NQP to target backends besides Parrot. In that time, we’ve had to build a lot of technology in order to be able to build Rakudo at all. Some things we’ve had to build more than once because the first time didn’t produce something satisfactory (where satisfactory means “actually meets our needs”, not “is the most awesome thing ever possible”). Software is, fairly often, as much about learning as it is about building. The more complex the domain you’re working in, there more this applies, and the more likely it is that you’ll have to build one to throw away. By now we’ve thrown away a parser engine, an AST, and about 3 implementations of roles. :-)&lt;/p&gt;
&lt;p&gt;Of course, there’s the build/buy thing, where buy in open source really means “buy into”, as in use an existing library. We’ve done a bunch of that too, such as libtommath for our big integer support and dyncall for NativeCall support. But the closer something is to the “core domain” – the thing that makes your product distinctive and special – the less able you are to use something off the shelf. Parsing Perl 6 really needs to be done with a Perl 6 grammar, using Longest Token Matching. Its object system really needs something that supports meta-programming, representation polymorphism and gradual typing. Getting BEGIN/eval right and supporting compilation and having the possibility for lexical and anonymous types and packages, which can be dynamically constructed and exported, also left us with something to build (this is the work that led to bounded serialization).&lt;/p&gt;
&lt;p&gt;Eventual portability has been a design factor in what we’ve built for quite a while. While the only 6model implementation to have become complete enough to support all of Rakudo’s object needs so far is the one running on Parrot, the initial prototypes of 6model were done on the .Net CLR. This was in no small part to make sure that there was a feasible way to implement it on such a VM. Granted, what I actually discovered was a less than awesome way to build it on the CLR (and what I’m doing on the JVM this time around fits in far better with the JVM’s world view). But it was a design consideration from the start.&lt;/p&gt;
&lt;p&gt;When we updated PAST, the previous AST representation, to QAST (Q is just P++ :-)) then once again portability was a concern; the VM specific bits were all placed under a QAST::VM node type. This makes it easy to escape to the underlying VM where needed or where it is most expedient, but it’s both explicit and done in a way that allows specification of what to do on other backends. As part of this work we also build support for the nqp::op abstraction directly into the AST format. The nqp::ops form an opcode set independent of any particular VM. These get mapped as part of turning a QAST tree into code for the target backend (thus meaning there’s no overhead for them in the generated code). They may map directly to the VM’s opcodes, a function or method call in the VM, or do some more complex code generation.&lt;/p&gt;
&lt;p&gt;The other important piece of the groundwork for portability is that we implemented Rakudo in a mixture of Perl 6 and NQP, and over time have got NQP to the point where it is also written in NQP (and thus can compile itself). This has been a gradual thing; the earliest NQP editions were written directly in PIR, and with time we’ve migrated those bits to NQP – usually at the same point we were doing other improvements already. For example, pmichaud++ wrote the latest edition of the regex engine, with LTM support, in NQP. PAST, written in PIR, was replaced by QAST, written in NQP. And 6model’s meta-objects were, from the start, expressed in NQP too. It’s pretty neat that NQP’s definition of things so fundamental as classes is actually written in NQP. It means that we don’t have to port classes and roles, just the primitives they are made out of.&lt;/p&gt;
&lt;h3&gt;So digging into the JVM port itself…&lt;/h3&gt;
&lt;p&gt;With all of the above mentioned things in place, it was possible to form a fairly concrete roadmap for porting NQP, then Rakudo, over to the JVM. Being comfortable that the result would enable us to get a fully functional Rakudo on the JVM and an idea of how to get there was important. It’s easy to implement a subset, but if it isn’t factored in a way that lets you do the rest afterwards then you’re in bother and it’ll be time for re-work. My hope was that, after some years of learning about things that don’t work and replacing them with things that do, this time much of the re-work could be avoided. A starting point for this was taking a good look at the JVM’s instruction set, as well as considering what JVMs are typically good at doing.&lt;/p&gt;
&lt;p&gt;The JVM is a stack machine. This is in contrast to Parrot, which is a register machine. Thankfully, this is mostly a code generation detail rather than being especially deep. As well as the stack, a given method can have local variables (note that everything that contains code on the JVM is called a method, even subroutines, but they call them static methods because it sounds so much more OO :-)). These can hold longer-lived things, so in a sense could be used a bit like Parrot registers. In general, the code generation from QAST uses the stack where possible and falls back to locals where needed. This is because stack usage fits well with what a JVM expects to be doing, and also what its bytecode format expresses most compactly.&lt;/p&gt;
&lt;p&gt;Locals have an important restriction: they can only be accessed directly in the scope where they are declared. There is no notion of nested methods at the JVM level. This means that locals are not suitable for implementing lexical variables. Thankfully, there is a well established solution: promote such things onto the heap, keeping them in some kind of invocation record. This is what happens with closures in C# on the CLR, for example. There are a bunch of ways to do this transform, with various trade-offs. I’ve done one that was fairly fast to implement, but also enables lookup by array indexing rather than needing a named (hash) lookup in the vast majority of cases. As well as an array index being algorithmically cheaper than a hash lookup, the JVM supports array indexing natively in its opcode set, but not hash lookups.&lt;/p&gt;
&lt;p&gt;Talking of allocating things on the heap brings us nicely to think about objects. JVMs are very good at fast allocation and collection of objects, because they have to be; there is no stack allocation in Java of anything non-trivial. Of course, that doesn’t mean the VM can’t do escape analysis and stack allocate under the hood. That the VM is really good at object allocation and GC means we don’t need to worry too much about lexicals leading to invocation records on the heap; there’s plenty of performant uses of this approach in the wild. Furthermore, most records will be very short lived, nicely meeting the generational hypothesis (which is that most objects are either short lived or long lived, and so we can optimize separately for each through doing generational garbage collection).&lt;/p&gt;
&lt;p&gt;While invocation records are relatively internal, of course NQP and Perl 6 involve lots of user-visible objects. From the things you think about as objects (and call “new” on) to things like scalar containers, strings, boxed integers and so forth, both NQP and Perl 6 lead to plenty of allocations. While some things are quite predictably shaped, most come from user class definitions. Ideally, we’d like it if a Perl 6 class definition like:&lt;/p&gt;
&lt;pre&gt;class Point {
    has $!surface;
    has num $!x;
    has num $!y;
}&lt;/pre&gt;
&lt;p&gt;Was to use memory similarly to if you wrote something in Java like:&lt;/p&gt;
&lt;pre&gt;class Point {
    private Object surface;
    private double x;
     private double y;
}&lt;/pre&gt;
&lt;p&gt;At the same time, we know that the JVM’s idea of type is some way off the Perl 6 notion of type, so we can’t simply turn Perl 6 classes into JVM classes. Thankfully, 6model has from the start been designed around the idea of representation polymorphism. Really, this is just a separation of concerns: we decouple the details of memory representation and access from the notion of being a type and dispatch. The former is handled by a representation, and the latter two by a meta-object. One early but important observation I made when designing 6model is that the representation will always couple closely to the underlying runtime (and thus would need to be implemented for each runtime we wanted to run on), whereas the other bits can be expressed in a higher level way, with the common cases made efficient by caching. Thus there’s no reason to re-implement classes and roles per VM, but there is a need to provide a different, VM-specific way to do P6opaque (the default representation for NQP and Perl 6 objects).&lt;/p&gt;
&lt;p&gt;The C implementation of P6opaque on Parrot works by calculating a memory layout – essentially, figuring out a struct “on the fly”. What’s the JVM equivalent of that? Well, that’s just creating a JVM class on the fly and loading it. Is the JVM capable of doing that? Sure, it’s easily dynamic enough. Furthermore, once we’ve done that little bit of bytecode generation, it’s a perfectly ordinary JVM class. This means that the JIT compiler knows what to do with it. Does doing any of this require changes to the meta-objects for classes in NQP and Rakudo? No, because these details are all encapsulated in the representation. Things like these are good signs for a design; it tends to show that responsibilities are correctly identified and segregated.&lt;/p&gt;
&lt;h3&gt;So, how’s the cross-compiler going?&lt;/h3&gt;
&lt;p&gt;Things are going nicely. Having got much of the way there with the NQP MOP, I turned to ModuleLoader and started to get together a basic setting (the setting being the place where built-ins are defined). With those in place, work has moved on to trying to pass the NQP test suite.&lt;/p&gt;
&lt;p&gt;The build process cross-compiles the MOP, module loader and setting. To run the test suite, each test is taken and cross-compiled against those, then the result of compiling it is run on the JVM. The fact we invoke NQP, then invoke the JVM twice in order to run each test gives quite a bit of fixed overhead per test; once we have NQP itself (that is, the compiler) cross-compiled and self-hosting on the JVM it’ll be down to a single invocation.&lt;/p&gt;
&lt;p&gt;The NQP test suite for the NQP language itself consists of 65 test files. 3 of them are specific to Parrot, so there’s 62 that are interesting to make run. As of today, we pass 46 of those test files in full. While some of those passing tests exercise relatively simple things (literals, operators, variables, conditionals, loops, closures), others exercise more advanced features (classes, roles, basic MOP functionality, runtime mixins and so forth). Of the 16 test files that remain, 9 of them depend on regexes or grammars. Getting those to run will be the focus of the next major chunk of work: porting the regex compiler and getting the NFA, Cursor and Match classes to cross-compile (which will involve some portability improvements). The other 7 relate to non-trivial, but smaller-than-grammars features (for example, 2 are about multiple dispatch, which I’m working on porting at the moment).&lt;/p&gt;
&lt;p&gt;It was only three weeks ago when I wrote that the JVM port did not even manage “hello world” yet, and that I had little more to show than something that could turn a range of QAST trees into JVM bytecode. Three weeks later and we’re running around 75% of the NQP test files, and timotimo++ was even able to feed an almost unmodified Levenstein distance implementation written in NQP to the cross-compiler and have it run on the JVM.&lt;/p&gt;
&lt;p&gt;So, mad amounts of coding have taken place? Well, only sorta…I’ve taught two three-day classes for $dayjob in the last couple of weeks also. :-) Mostly, progress has been fast now because the foundations it is building upon have proved fairly solid. For the backend, this is in no small part down to having grown a test suite for the QAST to JVM phase of the work as it progressed. The fact we could happily couple this new backend to the existing NQP parser is thanks to the compiler being structured as a pipeline of stages, each one strongly isolated from the others, just passing a data structure between them. In my teaching work, I often encourage automated testing and talk a lot about the importance of enforcing carefully chosen, well-defined, information-centric boundaries between components. It’s pleasing to see these things paying off well in my Perl 6 work also. :-)&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/263/&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/263/&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=263&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">I am going to FOSDEM</title>
		<link href="http://strangelyconsistent.org/blog/i-am-going-to-fosdem"/>
		<id>tag:strangelyconsistent.org,2013-02-01:blog/i-am-going-to-fosdem</id>
		<updated>2013-01-31T23:22:38+00:00</updated>
		<content type="html">&lt;p&gt;&lt;em&gt;(Using exclusively five word sentences.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Perl Mongers needed speakers quickly. &quot;Very Late Call for Papers&quot;. &quot;Why so late&quot;, you ask. Perl dev room was denied. Another community got the room. Perl only got a booth. The other community backed out. Perl then got the room. Therefore, talks were requested urgently. Only about one week notice. &lt;a href=&quot;https://nxadm.wordpress.com/2013/01/25/perlfosdem2013-a-very-late-call-for-papers/&quot;&gt;The announcement is recorded here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I missed that blog post. But I got an email. Wendy wrote to some people. I was one of them. Talk about very short notice. Eight days before the talk! That must be a record. Nothing to be done, though. The invitation was nicely worded. I considered whether to go. Finally I decided I would.&lt;/p&gt;

&lt;p&gt;My talk concerns Perl 6. I have given it before. It was in Bristol, England. You were likely not there. That time, jnthn helped me. Now I will talk alone. I must give it quickly. I only have 20 minutes. That is not a lot. I rather like challenges, though. Looking forward to it all.&lt;/p&gt;

&lt;p&gt;Will you come to &lt;a href=&quot;https://fosdem.org/2013/&quot;&gt;FOSDEM&lt;/a&gt;? I certainly hope you will. If you do, stop by. I will give my talk. &lt;a href=&quot;https://fosdem.org/2013/schedule/event/perl6__dude_wheres_my_flying_car/&quot;&gt;&quot;Where is my flying car?&quot;&lt;/a&gt; A reference to the future. In the future, cars fly. Also, Perl 6 is everywhere. Especially in the flying cars. It will be totally awesome. My talk is about that. Or sorta kinda about that. It is about Perl 6. Why is it not released? What makes me keep hoping? What has been implemented already? That is what it covers.&lt;/p&gt;

&lt;p&gt;Looking forward to the weekend.&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-US">Rakudo Star 2013.01 released</title>
		<link href="http://rakudo.org/2013/01/30/rakudo-star-2013-01-released/"/>
		<id>http://rakudo.org/?p=242</id>
		<updated>2013-01-30T18:51:44+00:00</updated>
		<content type="html" xml:lang="en-US">&lt;p&gt;On behalf of the Rakudo and Perl 6 development teams, I’m happy to announce the January 2013 release of “Rakudo Star”, a useful and usable distribution of Perl 6.  The tarball for the  January 2013 release is available from &lt;a href=&quot;http://rakudo.org/downloads/star/&quot;&gt;the download page&lt;/a&gt;.  A Windows .MSI version of Rakudo star will usually appear in the downloads area shortly after the tarball release.&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 2013.01 [0] of the Rakudo Perl 6 compiler [1], version 4.10.0 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;Some of the new features added to this release include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sink context (what some other languages call void context) is now enforced correctly. This means that for-loops are now lazy by default. It fixes the bug where a map in sink context would not execute, and also means that a Failure returned to sink context will be properly thrown.&lt;/li&gt;
&lt;li&gt;‘require’ now works with indirect module names&lt;/li&gt;
&lt;li&gt;Restored socket read semantics to returning the requested number of bytes&lt;/li&gt;
&lt;li&gt;$obj.Some::Role::meth() now passes the correct $obj&lt;/li&gt;
&lt;li&gt; try/CATCH now returns Nil when the CATCH is triggered, rather than the exception; this brings it in line with try without a CATCH&lt;/li&gt;
&lt;li&gt;whatever-star cases of splice now implemented&lt;/li&gt;
&lt;li&gt;can now import multis with the same name from different modules, provided all dispatchers are onlystar&lt;/li&gt;
&lt;p&gt;This release also contains a range of bug fixes, improvements to error reporting&lt;br /&gt;
and better failure modes.&lt;/p&gt;
&lt;p&gt;The following features have been deprecated or modified from previous&lt;br /&gt;
releases due to changes in the Perl 6 specification, and are being removed&lt;br /&gt;
or changed as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;postcircumfix:&amp;lt;[ ]&amp;gt; and postcircumfix:&amp;lt;{ }&amp;gt; will become multi-subs rather than multi-methods. Both at_pos and at_key will remain methods.&lt;/li&gt;
&lt;li&gt; Unary hyper ops currently descend into nested arrays and hashes.  This will change to make them equivalent to a one-level map.&lt;/li&gt;
&lt;li&gt;The Str.ucfirst builtin is deprecated; it will be replaced by Str.tc.&lt;/li&gt;
&lt;li&gt; Leading whitespace in rules and under :sigspace will no longer be&lt;br /&gt;
converted to &amp;lt;.ws&amp;gt; .  For existing regexes that expect this conversion, add a &amp;lt;?&amp;gt; in front of leading whitespace to make it meta again.&lt;/li&gt;
&lt;li&gt; The ?-quantifier on captures in regexes currently binds the capture slot to a List containing either zero or one Match objects; i.e., it is equivalent to “** 0..1″.  In the future, the ?-quantifier will bind the slot directly to a captured Match or to Nil.  Existing code can manage the transition by changing existing ?-quantifiers to use “** 0..1″, which will continue to return a List of matches.&lt;/li&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;/p&gt;
&lt;ul&gt;
&lt;li&gt;advanced 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;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 an online resource at http://perl6.org/compilers/features&lt;br /&gt;
that lists the known implemented and missing features of Rakudo&lt;br /&gt;
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;
A draft of a Perl 6 book is available as docs/UsingPerl6-draft.pdf&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 http://rakudo.org/how-to-help, 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/2013.01&lt;br /&gt;
[1] http://github.com/rakudo/rakudo&lt;br /&gt;
[2] http://parrot.org/&lt;/p&gt;&lt;/ul&gt;&lt;/ul&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">Perl 6 changes - 2013W04</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W04.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W04.html</id>
		<updated>2013-01-26T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Today, the main features is &lt;code&gt;.delta&lt;/code&gt; method in &lt;code&gt;DateTime&lt;/code&gt; and &lt;code&gt;Date&lt;/code&gt;. And as usually, bug fixes that make language do what you mean.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;Added &lt;code&gt;DateTime.delta&lt;/code&gt; and &lt;code&gt;Date.delta&lt;/code&gt; to the specification.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;s///&lt;/code&gt; resets &lt;code&gt;$/&lt;/code&gt; on failure.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;s///&lt;/code&gt; returns &lt;code&gt;False&lt;/code&gt; on failure.&lt;/li&gt;

&lt;li&gt;Regular expressions allow &lt;code&gt;$()&lt;/code&gt; syntax for arbitrary expressions.&lt;/li&gt;

&lt;li&gt;Socket functions work better with non-ASCII characters.&lt;/li&gt;

&lt;li&gt;Errors about function only taking positional arguments now specify name of function that was called.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;DateTime.truncated-to&lt;/code&gt; now takes &lt;code&gt;TimeUnit&lt;/code&gt; enum as argument.&lt;/li&gt;

&lt;li&gt;Implemented &lt;code&gt;DateTime.delta&lt;/code&gt; and &lt;code&gt;Date.delta&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Names are suggested for &lt;code&gt;--&amp;gt; Type&lt;/code&gt; (subroutine return type).&lt;/li&gt;

&lt;li&gt;&lt;code&gt;/&amp;lt; hello &amp;gt;/&lt;/code&gt; now works correctly (matching &lt;code&gt;hello&lt;/code&gt;), just like &lt;code&gt;/&amp;lt; hello world &amp;gt;/&lt;/code&gt; already did.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Helpful error messages</title>
		<link href="http://glitchmr.github.com/helpful-error-messages.html"/>
		<id>http://glitchmr.github.com/helpful-error-messages.html</id>
		<updated>2013-01-20T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Rakudo lately got an interesting change. Consider following buggy code (for array binary search), written in functional style (I’m using recursion). The bug is that it doesn’t work because of two different identifiers &lt;code&gt;binary-search&lt;/code&gt; and &lt;code&gt;binary_search&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;Trying to run it shows compile time error message. The compile part is important. If you would remove &lt;code&gt;binary-search&lt;/code&gt; call at end, it still would report an error, unlike Python.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;===SORRY!===
Undeclared routine:
    binary_search used at lines 2, 8, 9. Did you mean '&amp;amp;binary-search'?&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now you know what’s wrong and you can easily fix it. Unlike let’s say, Jekyll that I use for my blog. Not only it doesn’t work on my PC for some reason, but also &lt;a href=&quot;https://github.com/GlitchMr/glitchmr.github.com/commits/master/_posts/2013-01-20-helpful-error-messages.md&quot; title=&quot;GitHub: GlitchMr/glitchmr.github.com (history for this post&quot;&gt;refused to highlight my code&lt;/a&gt; - it gave some sort of XML error (it simply said “REXML could not parse this XML/HTML”). I gave up and put it on Gist. And the first attempt was failed, because embed code is &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; and Jekyll self-closed the tag (XML-style, but this is HTML). This is annoying.&lt;/p&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">The Perl 6 Coding Contest (2012 edition) is now closed</title>
		<link href="http://strangelyconsistent.org/blog/the-perl-6-coding-contest-2012-edition-is-now-closed"/>
		<id>tag:strangelyconsistent.org,2013-01-19:blog/the-perl-6-coding-contest-2012-edition-is-now-closed</id>
		<updated>2013-01-19T17:24:06+00:00</updated>
		<content type="html">&lt;div style=&quot;background: #ded; margin: 1em; padding: 1em;&quot;&gt;&lt;code&gt;&quot;I've found this year the tasks were harder, but I've also spend more time thinking about the problems and less worrying about bugs in the interpreter... which is definitely good.&quot;&lt;br /&gt;        — a contestant&lt;/code&gt;&lt;/div&gt;

&lt;div style=&quot;background: #ded; margin: 1em; padding: 1em;&quot;&gt;&lt;code&gt;&quot;This year's problems were a lot more approachable to me and motivated me to learn more perl6.&quot;&lt;br /&gt;        — another contestant&lt;/code&gt;&lt;/div&gt;

&lt;p&gt;...aaaand we're done. The five weeks are up.&lt;/p&gt;

&lt;p&gt;I'm now all caught up processing submissions sent to me. So let's summarize, as usual:&lt;/p&gt;

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

&lt;p&gt;These figures during p6cc2010 and p6cc2011 were (18, 5, 26) and (35, 6, 27), respectively. So all in all, it seems that we've entered a steady state both in terms of contestants and submissions. I'm grateful to get so much interesting Perl 6 code to read through and review.&lt;/p&gt;

&lt;p&gt;Many people told me this year that they had noble plans to send in lots of solutions, but in the end didn't find the time for it. I'm assuming many contestants I haven't heard from have similar stories. That's fine; the contest is designed to encourage you to do the tasks, but not to force you to. If the contest made you take a look at the tasks, or at Perl 6, then in some sense that's a win, too.&lt;/p&gt;

&lt;p&gt;My plan is, just like previous years, to go through the five tasks in order, publish all the reviews and an appropriately thoughtful blog post that summarizes the tasks and its solutions. With luck, we'll all learn something together.&lt;/p&gt;

&lt;p&gt;It takes time to do these reviews. Sometimes a lot of time. That said, I hope to get through these submissions quickly. Expect something like a post each week. That's the goal.&lt;/p&gt;

&lt;p&gt;After which I'll sum up and select a winner, also in a blog post. Exciting!&lt;/p&gt;

&lt;p&gt;So, expect the next blog post to be about the first task: &quot;Tell knights from knaves based on what they say.&quot; 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">Perl 6 changes - 2013W03</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W03.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W03.html</id>
		<updated>2013-01-19T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;It’s another Perl 6 changes article (at this point I wonder why I still do that). But as long the changes are impressive (and the cake is the lie), I guess mentioning changes is worth it.&lt;/p&gt;&lt;p&gt;Rakudo 2013.01 was tagged in the Git repository. It wasn’t yet released, but it’s really close to the releease (and frozen).&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;rakudo_perl_in_rakudo_201301&quot;&gt;Rakudo Perl (in Rakudo 2013.01)&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;** 0&lt;/code&gt; in regexpes works correctly matching nothing.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl_post_rakudo_201301&quot;&gt;Rakudo Perl (post Rakudo 2013.01)&amp;gt;&lt;ul&gt;
&lt;li&gt;Compiler hints invalid variable names. For example, typing &lt;code&gt;$variabel&lt;/code&gt; when you already have &lt;code&gt;$variable&lt;/code&gt; declared hints that variable.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;More meaningful error message is thrown when &lt;code&gt;printf&lt;/code&gt; tries to consume more arguments than available.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">A quick JVM backend update</title>
		<link href="http://6guts.wordpress.com/2013/01/18/a-quick-jvm-backend-update/"/>
		<id>http://6guts.wordpress.com/?p=261</id>
		<updated>2013-01-18T00:44:00+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Things have been moving along quite rapidly on the JVM backend since my last post. Sadly, I’m too sick to hack on anything much this evening (hopefully, this turns out to be a very temporary affliction…) but I can at least just about write English, so I figured I’d provide a little update. :-)&lt;/p&gt;
&lt;p&gt;Last time I blogged here, I was able to compile various QAST trees down to JVM bytecode and had a growing test suite for this. My hope was that, by some inductive handwaving, being able to compile a bunch of QAST nodes and operations correctly would mean that programs made up of a whole range of them would also compile correctly. In the last week or so, that has come to pass.&lt;/p&gt;
&lt;p&gt;Having reached the point of having coverage of quite a lot of QAST, I decided to look into getting an NQP frontend plugged into my QAST to JVM backend. In the process, I found that NQP lacked the odd VM abstraction here and there in the common prelude that it includes with every QAST tree it produces. Thankfully, this was easily rectified. Even better, I got rid of a couple of old hacks that were no longer required. With those things out of the way, I found that this common prelude depended on a couple of operations that I’d not got around to implementing in the JVM backend. These were also simple to add. And…here endeth the integration story. Yup, that was it: I now had a fledgling NQP cross-compiler. An NQP compiler running on Parrot, but producing output for the JVM.&lt;/p&gt;
&lt;p&gt;This result is rather exciting, because…&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It’s using exactly the same parse and action stages as when we’re targeting Parrot. No hacks, no fork. The QAST tree we get from the NQP source code that goes in is exactly the one we get when targeting Parrot. Everything that happens differently happens is beyond that stage, in the backend. This is an extremely positive sign, architecturally.&lt;/li&gt;
&lt;li&gt;With a couple of small additions to handle the prelude, I was immediately able to cross-compile simple NQP programs and run them on the JVM. There’s no setting or MOP yet, but the basics (variables, loops, subroutines with parameters, even closures) Just Worked.&lt;/li&gt;
&lt;li&gt;The program I wrote to glue the JVM backend work and the existing NQP frontend together was about 30 lines of NQP code.&lt;/li&gt;
&lt;li&gt;This whole integration process was about an afternoon’s worth of work.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since I got that working, my focus has been on getting nqp-mo (the NQP meta-objects) to cross-compile. This is where classes and roles are implemented, and thus is a prerequisite for cross-compiling the NQP setting, which is in turn a prerequisite for being able to start cross-compiling and running the NQP test suite. The NQP MOP is about 1500 lines of NQP code, and at this point I’ve got about 1400 of them to cross-compile. So I’m almost there with it? Well, not quite. Turns out that the next thing I need to port is the bounded serialization stuff. That’s a rather hairy chunk of work.&lt;/p&gt;
&lt;p&gt;Anyway, things are moving along nicely. The immediate roadmap is to get the bounded serialization to the point where it’s enough for the NQP MOP, then move on to getting a minimal setting cross compiling. Beyond that, it’ll be working through the test suite, porting the regex compilation and seeing what else is needed to cross-compile the rest of NQP.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/261/&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/261/&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=261&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">Perl 6 changes - 2013W02</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W02.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W02.html</id>
		<updated>2013-01-12T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I’m going to show another Perl 6 changes article. I’m so lazy, that I really don’t know what to put here, so I guess I’ll now show the list of new features.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--&amp;gt;&lt;/code&gt; (return type) acts more like a normal subroutine parameter.&lt;/li&gt;

&lt;li&gt;Added &lt;code&gt;squish&lt;/code&gt; method, working like &lt;code&gt;uniq&lt;/code&gt; utility in UNIX - it only removes elements if it is duplicate of previous element.&lt;/li&gt;

&lt;li&gt;Adjusted precedence of set operators.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;stdpm6&quot;&gt;STD.pm6&amp;gt;&lt;ul&gt;
&lt;li&gt;Adjusted precedence of set operators.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Implemented &lt;code&gt;require ::($module) 'something'&lt;/code&gt; syntax.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;$socket.read($bytes)&lt;/code&gt; now returns &lt;code&gt;$bytes&lt;/code&gt; bytes, if possible. Previously it only read only 256 bytes.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;$object.My::Role::method()&lt;/code&gt; works correctly and uses correct &lt;code&gt;self&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;try&lt;/code&gt; with &lt;code&gt;CATCH&lt;/code&gt; returns &lt;code&gt;Nil&lt;/code&gt; on exception, like it did without explicit &lt;code&gt;CATCH&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Failures in sink context won’t throw if they were handled.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;splice&lt;/code&gt; supports whatever star (&lt;code&gt;*&lt;/code&gt;).&lt;/li&gt;

&lt;li&gt;Adjusted precedence of set operators.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;Junction.Str&lt;/code&gt; now gives string, instead of junction with every element converted to the string.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Adjusted precedence of set operators.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">A Bunch of Rakudo News</title>
		<link href="http://6guts.wordpress.com/2013/01/10/a-bunch-of-rakudo-news/"/>
		<id>http://6guts.wordpress.com/?p=259</id>
		<updated>2013-01-10T01:59:04+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Seems it’s high time for some news here. It’s not that I didn’t do any blogging about Perl 6 in December; it’s just that all of those posts were over on the &lt;a href=&quot;https://perl6advent.wordpress.com/&quot;&gt;Perl 6 advent calendar&lt;/a&gt;. Anyway, now it’s a new year, and I’m digging back into things after an enjoyable Christmas and New Year’s break in the UK with family and friends. Here’s a bunch of things that already happened but I didn’t get around to talking about here yet, and some things that will be coming up.&lt;/p&gt;
&lt;h3&gt;Better Parse Errors In 2012.12&lt;/h3&gt;
&lt;p&gt;Ever had Rakudo tell you there’s a problem on line 1, when it’s really on line 50? Or wished that even in the common case where it gets the line right, it would tell you exactly where on the line things went wrong? Or how about the time it told you “Confused” because you got a closing paren too many?&lt;/p&gt;
&lt;p&gt;Many of my contributions to the 2012.12 Rakudo release centered around improving its reporting of parse errors. STD, the standard Perl 6 grammar, has had much better error reporting than Rakudo for a while. Therefore, I spent a bunch of time aligning our error reporting more closely with what STD does. Some of this is cosmetic: you get the colored output and the indication of the parse location. But while these cosmetic changes will be the most immediately visible thing, the changes go far deeper. Of note, a high water mark is kept so we can be a lot more accurate in reporting where things came unstuck, and we track what was expected so we can produce better errors. Just doing the cosmetic stuff without being able to give it a better location to report wouldn’t have helped so much. :-)&lt;/p&gt;
&lt;p&gt;One other change is that we don’t bail out on the first thing that’s wrong when it’s possible to survive and continue parsing. When this is possible, up to 10 errors will be reported (since that’s typically a screen worth). Of course, some things just hose the parse and we can’t continue in any sensible way.&lt;/p&gt;
&lt;p&gt;Hopefully, these improvements will make using Rakudo feel a lot nicer. Already on channel, I can feel the feedback we’re giving about parse errors when people use the evalbot is often a lot more pleasant and informative. Of course, there’ll be more improvements in the future too, but this is a big step forward.&lt;/p&gt;
&lt;h3&gt;Faster Auto-Threading&lt;/h3&gt;
&lt;p&gt;The junction auto-threader could sometimes be insanely slow. As in, ridiculously so. After hearing a bunch of reports about this, I decided to dig in and work out why. A rewrite later, the little benchmark I was using with it ran almost 30 times faster. Not so bad… :-) This change also made it into the 2012.12 release.&lt;/p&gt;
&lt;h3&gt;JVM Backend Preparations Underway&lt;/h3&gt;
&lt;p&gt;I’ve talked plenty about plans for NQP and Rakudo to run on things besides Parrot for a while now. Over the last year or two, we’ve laid a lot of the groundwork for this. What’s been especially pleasing is that it’s also made Rakudo a better quality Perl 6 implementation on Parrot, thanks to the many architectural improvements. Of note, in many places we’ve closed semantic gaps between what Perl 6 wants and the primitives we were building it out of; the new QAST (Q Abstract Syntax Tree) is a great example.&lt;/p&gt;
&lt;p&gt;Anyway, with NQP now being written pretty much entirely in NQP, and many of the right abstractions in place, it felt like time to start slowly picking away at getting 6model ported to the JVM and work on turning QAST trees into Java bytecode. I quietly started on this in November, and mentioned the existence of the work on #perl6 in December. I was delighted to see Coke++ jump in and start working through the &lt;a href=&quot;https://github.com/jnthn/nqp-jvm-prep/blob/master/docs/LHF.md&quot;&gt;Low Hanging Fruit&lt;/a&gt; – a file where I’m putting tasks that should be relatively easy to pick off. I actually had to re-fill it, after the last round were depleted. ;-) By now, quite a few bits of QAST are supported and the 6model on JVM implementation is coming along nicely. Yes, this means it’s already capable of doing basic meta-programming stuff.&lt;/p&gt;
&lt;p&gt;Note that this work isn’t at the stage where it’s of use for anything yet. You can’t even write a say(“hello world”) in NQP and have it run on the JVM yet, since all the work so far is just about turning QAST trees into JVM bytecode and building the runtime support it needs. That may seem like a curious way to work, but once you do enough compiler stuff you find yourself thinking quite naturally in trees. It meant I didn’t have to worry about creating some stripped-down NQP that could emit super-simple trees to be able to test really simple things. After all, the goal is to run NQP itself on the JVM, and then Rakudo, and only then will things be interesting to the everyday user.&lt;/p&gt;
&lt;p&gt;To address a couple of immediate concerns that some may have…&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No, this is not a case of “stop running on Parrot, start running on JVM”. It’s adding an additional backend, much like pmurias++ has been working on adding a JavaScript backend for NQP. Of course, I expect resource allocation in the future to be driven by which backends users desire most. For some, the JVM is “that evil Oracle thing” and they don’t want to touch it. For others, the JVM is “the only thing our company will deploy on”. Thus I expect this work to matter more to some people than others. That’s fine.&lt;/li&gt;
&lt;li&gt;No, targeting multiple backends doesn’t mean performance-sucking abstractions everywhere. It’s a pretty typical thing for a compiler to do. As usual, it’s about picking the right abstractions. The debugger was implemented as an additional Rakudo frontend without a single addition to Rakudo or NQP or anything anywhere in the stack. That was possible because things were designed well. I’m sure the process of getting things running on the JVM will flag up a few places where things aren’t designed as well as they need to be, but already I’m seeing a lot of places where things are mapping over very nicely indeed.&lt;/li&gt;
&lt;li&gt;No, this doesn’t mean that all other Rakudo development will grind to a halt. I’ve been working on the JVM backend stuff in November and December; both months saw a huge amount of Rakudo progress too. Things will go on that way.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Type System Improvements&lt;/h3&gt;
&lt;p&gt;Rakudo does a lot of things well when it comes to supporting the various kinds of types Perl 6 offers, but there are some weak areas. Here are some of the things I plan to focus on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Getting the definedness constraint stuff working better (the :D and :U annotations). At the moment, they’re supported as a special case in multiple dispatch and the signature binder. In reality, they’re meant to be first class and work everywhere. You may not think you care about these much. Actually, you probably at least indirectly do, because once the optimizer is able to analyze them, it’ll be able to do a bunch more inlining of things than it can today. :-)&lt;/li&gt;
&lt;li&gt;Getting coercion types in place. Again, this is turning the special-cased “as” syntax into the much more general coercion type syntax (for example, Int(Str) is the type that accepts a Str and coerces it into an Int).&lt;/li&gt;
&lt;li&gt;Getting native types much better supported. At the moment, you can use them but…there are pitfalls. Having them available has been a huge win for us in the CORE setting, where we’ve used them in the built-ins. But they’re still a bit “handle with great care”. I want to change that.&lt;/li&gt;
&lt;li&gt;Implementing compact arrays.&lt;/li&gt;
&lt;li&gt;Improving our parametric type and type variable support. Many things work, but there are some fragile spots and some bugs that want some attention.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I intend to have some of these things in the January release, and a bunch more in the February one. We’ll see how I get along. :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/6guts.wordpress.com/259/&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/259/&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=259&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">Perl 6 changes - 2013W01</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2013W01.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2013W01.html</id>
		<updated>2013-01-05T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I have finally updated the number before ‘W’. Well, we have the new year - 2013. And because of that I would like to say ‘Happy new year!’.&lt;/p&gt;&lt;p&gt;This is yet another article in “Perl 6 changes”. I lately don’t put articles other than those, but I don’t have many ideas for those, really.&lt;/p&gt;&lt;p&gt;By the way, I find it interesting that no new posts on Planet Six appeared between my previous Perl 6 changes article and current Perl 6 changes article.&lt;/p&gt; id='incompatible_changes'&amp;gt;Incompatible changes&amp;gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;“SAFE” setting is now removed. You’re supposed to use “RESTRICTED” setting now.&lt;/li&gt;
&lt;/ul&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Using non-associative operators when association is needed throws typed error message.&lt;/li&gt;

&lt;li&gt;Compile time optimizations for &lt;code&gt;(|)&lt;/code&gt; signature (accepting anything), It’s worth handling because it’s commonly used for &lt;code&gt;proto&lt;/code&gt;s.&lt;/li&gt;

&lt;li&gt;Fixed typos in &lt;code&gt;X::Import::Redeclaration&lt;/code&gt; error message.&lt;/li&gt;

&lt;li&gt;Removed old &lt;code&gt;perl6doc&lt;/code&gt; documentation.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;DateTime.Date&lt;/code&gt; now works correctly.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;.pick&lt;/code&gt; now randomizes better on large ranges.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;infix:&amp;lt;-&amp;gt;(Instant, Instant)&lt;/code&gt; now supported.&lt;/li&gt;

&lt;li&gt;Bitwise operations support big integers.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes - 2012W52</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2012W52.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2012W52.html</id>
		<updated>2012-12-29T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;This is last “Perl 6 changes” update in this year. Enjoy.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;uniq&lt;/code&gt; method/subroutine, existing for long time in implementations is now mentioned in specification (with &lt;code&gt;===&lt;/code&gt; semantics).&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Use of suffix regex modifiers (P5-ism) in &lt;code&gt;s///&lt;/code&gt;, like &lt;code&gt;s////g&lt;/code&gt; is now detected.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en-US">Rakudo Star 2012.12 released</title>
		<link href="http://rakudo.org/2012/12/27/rakudo-star-2012-12-released/"/>
		<id>http://rakudo.org/?p=237</id>
		<updated>2012-12-27T19:53:53+00:00</updated>
		<content type="html" xml:lang="en-US">&lt;p&gt;On behalf of the Rakudo and Perl 6 development teams, I’m happy to announce the December 2012 release of “Rakudo Star”, a useful and usable distribution of Perl 6.  The tarball for the  December 2012 release is available from &lt;a href=&quot;http://rakudo.org/downloads/star/&quot;&gt;the download section.&lt;/a&gt; A Windows .MSI version of Rakudo star will usually appear in the downloads area shortly after the tarball release.&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 &lt;a href=&quot;https://github.com/rakudo/rakudo/blob/nom/docs/announce/2012.12&quot;&gt;2012.12&lt;/a&gt; of the &lt;a href=&quot;http://github.com/rakudo/rakudo&quot;&gt;Rakudo Perl 6 compiler&lt;/a&gt;, version 4.10.0 of the &lt;a href=&quot;http://parrot.org/&quot;&gt;Parrot Virtual Machine&lt;/a&gt;, and various modules, documentation, and other resources collected from the Perl 6 community.&lt;/p&gt;
&lt;p&gt;Some of the new features added to this release include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; Parse errors are much improved, and follow STD, the standard parser,&lt;br /&gt;
  much more closely; they are more accurate and more information is given&lt;/li&gt;
&lt;li&gt; Rakudo now keeps parsing after some less serious errors&lt;/li&gt;
&lt;li&gt; Better errors for various parse failures&lt;/li&gt;
&lt;li&gt; The junction autothreader is now an order of magnitude faster&lt;/li&gt;
&lt;li&gt; Texas (ASCII) versions of the Set and Bag operators implemented&lt;/li&gt;
&lt;li&gt; Nested Pairs now give correct .perl output&lt;/li&gt;
&lt;li&gt; &lt;code&gt;{ a =&amp;gt; $_ }&lt;/code&gt; now correctly considered a block, not a hash as&lt;br /&gt;
before&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This release also contains a range of performance improvements, bug fixes, improvements to error reporting and better failure modes. &lt;/p&gt;
&lt;p&gt;The following features have been deprecated or modified from previous releases due to changes in the Perl 6 specification, and are being removed or changed as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; ‘for’-loops will become lazy, and are only evaluated eagerly in eager or sink (void) context. This means that if a for-loop is the last statement in a routine, it will usually run after the routine has returned, so it cannot call return() anymore.&lt;/li&gt;
&lt;li&gt; Unary hyper ops currently descend into nested arrays and hashes.  This will change to make them equivalent to a one-level map.&lt;/li&gt;
&lt;li&gt; The Str.ucfirst builtin is deprecated; it will be replaced by&lt;br /&gt;
Str.tc.&lt;/li&gt;
&lt;li&gt; Leading whitespace in rules and under :sigspace will no longer be converted to &amp;lt;.ws&amp;gt; .  For existing regexes that expect this conversion, add a &amp;lt;?&amp;gt; in front of leading whitespace to make it meta again.&lt;/li&gt;
&lt;li&gt; The ?-quantifier on captures in regexes currently binds the capture slot to a List containing either zero or one Match objects; i.e., it is equivalent to “** 0..1″.  In the future, the ?-quantifier will bind the slot directly to a captured Match or to Nil.  Existing code can manage the transition by changing existing ?-quantifiers to use “** 0..1″, which will continue to return a List of matches.&lt;/li&gt;
&lt;/ul&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;/p&gt;
&lt;ul&gt;
&lt;li&gt;advanced 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;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 an &lt;a href=&quot;http://perl6.org/compilers/features&quot;&gt;online resource that lists the known implemented and missing features of Rakudo and other Perl 6 implementations&lt;/a&gt;.&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 rakudobug@perl.org.&lt;/p&gt;
&lt;p&gt;See http://perl6.org/ for links to much more information about Perl 6, including documentation, example code, tutorials, reference materials, specification documents, and other supporting resources.  A draft of a Perl 6 book is available as docs/UsingPerl6-draft.pdf 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 http://rakudo.org/how-to-help, ask on the perl6-compiler@perl.org mailing list, or join us on IRC #perl6 on freenode.&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">Day 24 – An Advent Calendar</title>
		<link href="http://perl6advent.wordpress.com/2012/12/24/day-24-an-advent-calendar/"/>
		<id>http://perl6advent.wordpress.com/?p=1841</id>
		<updated>2012-12-24T00:00:47+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Recently I was unpacking some boxes of books and came across a book entitled &quot;&lt;a href=&quot;http://www.amazon.com/Basic-Computer-Programs-Charles-Sternberg/dp/0810451549&quot;&gt;BASIC Computer Programs for the Home&lt;/a&gt;&quot; by Charles D. Sternberg. Apparently my father had purchased this book in the early 1980s and had given it to me. In any case, my name was scrawled in the front cover in the manner an adolescent me would have done.&lt;/p&gt;
&lt;p&gt;Mostly this book is filled with simple BASIC programs that manage simple databases of various things: recipes, household budget, address book, music collections, book collections, school grades, etc. But the program that caught my eye and made me think of the Perl 6 Advent Calendar was one for printing a calendar starting at a particular month.&lt;/p&gt;
&lt;p&gt;Now, the version in this book is a little simple in that it asks for the starting month, year, the day of the week that the first month starts on, and how many months to print. I wanted something a little more like the Unix utility cal(1) program. Luckily, Perl 6 has date handling classes as part of the &lt;a href=&quot;http://perlcabal.org/syn/S32/Temporal.html&quot;&gt;specification&lt;/a&gt; and both major implemenations, &lt;a href=&quot;https://github.com/rakudo&quot;&gt;Rakudo and &lt;/a&gt;&lt;a&gt;Niecza&lt;/a&gt;, have actual implementations of these which should make creating the calendar quite easy.&lt;/p&gt;
&lt;p&gt;For reference, the output of the Unix cal(1) utility looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;       December 2012
    Su Mo Tu We Th Fr Sa
                       1
     2  3  4  5  6  7  8
     9 10 11 12 13 14 15
    16 17 18 19 20 21 22
    23 24 25 26 27 28 29
    30 31                 &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It also has some options to change the output in various ways, but I just want to focus on reproducing the above basic output.&lt;/p&gt;
&lt;p&gt;I'll need a list of month names and weekday abbreviations:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    constant @months = &amp;lt;January February March April May June July
                        August September October November December&amp;gt;;
    constant @days = &amp;lt;Su Mo Tu We Th Fr Sa&amp;gt;;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And it looks like the month and year are centered above the days of the week. Generating a calendar for May shows this to be the case, so I'll need a routine that centers text:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    sub center(Str $text, Int $width) {
        my $prefix = ' ' x ($width - $text.chars) div 2;
        my $suffix = ' ' x $width - $text.chars - $prefix.chars;
        return $prefix ~ $text ~ $suffix;
    }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, the mainline code needs two things: a month and a year. From this it should be able to generate an appropriate calendar. But, we should have a reasonable default for these values I think. Today's month and year seem reasonable to me:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    sub MAIN(:$year = Date.today.year, :$month = Date.today.month) {&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but if it's not today's month and year, then it's some arbitrary month and year we need info about. To do this we construct a new Date object from the month and year given.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        my $dt = Date.new(:year($year), :month($month), :day(1) );&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Looking at the calendar generated for December, it seems like we may actually output up to 6 rows of numbers since the month can start and end on a partial week. In order to implement this, I think I'll need some &quot;slots&quot; for each day. Each slot will either be empty or will contain the day of the month. The number of empty slots at the beginning of the month correspond to the day of the week that the first of the month occurs on. If the first is on Sunday, there will be 0 empty slots, if the first is on a Monday there will be 1 empty slot, if the first is on a Tuesday, there will be 2 empty slots, etc. This is remarkably similar to the number we get when we interrogate a Date object for the day of the week. The only wrinkle is that it returns 7 for Sunday when we actually need a 0. That's easily remedied with a modulus operator however:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        my $dt = Date.new(:year($year), :month($month), :day(1) );
        my $ss = $dt.day-of-week % 7;
        my @slots = ''.fmt(&quot;%2s&quot;) xx $ss;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That gives us the empty slots at the beginning, but what about the ones that actually contain the days of the month? Easy enough, we'll just generate a number for each day of the month using the Date object we created earlier.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        my $days-in-month = $dt.days-in-month;
        for $ss ..^ $ss + $days-in-month {
            @slots[$_] = $dt.day.fmt(&quot;%2d&quot;);
            $dt++
        }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we've got an array with appropriate values in the appropriate positions, all that's left is to actually output the calendar. Using the header line for our weekdays as a metric for the width of the calendar, and the routine we created for centering text, we can output the header portion of the calendar:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        my $weekdays = @days.fmt(&quot;%2s&quot;).join: &quot; &quot;;
        say center(@months[$month-1] ~ &quot; &quot; ~ $year, $weekdays.chars);
        say $weekdays;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then we iterate over each slot and output the appropriate values. If we've reached the end of the week or the end of the month, we output a newline:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        for @slots.kv -&amp;gt; $k, $v {
            print &quot;$v &quot;;
            print &quot;\n&quot; if ($k+1) %% 7 or $v == $days-in-month;
        }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Putting it all together, here is the final program:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    #!/usr/bin/env perl6

    constant @months = &amp;lt;January February March April May June July
                        August September October November December&amp;gt;;
    constant @days = &amp;lt;Su Mo Tu We Th Fr Sa&amp;gt;;


    sub center(Str $text, Int $width) {
        my $prefix = ' ' x ($width - $text.chars) div 2;
        my $suffix = ' ' x $width - $text.chars - $prefix.chars;
        return $prefix ~ $text ~ $suffix;
    }

    sub MAIN(:$year = Date.today.year, :$month = Date.today.month) {
        my $dt = Date.new(:year($year), :month($month), :day(1) );
        my $ss = $dt.day-of-week % 7;
        my @slots = ''.fmt(&quot;%2s&quot;) xx $ss;

        my $days-in-month = $dt.days-in-month;
        for $ss ..^ $ss + $days-in-month {
            @slots[$_] = $dt.day.fmt(&quot;%2d&quot;);
            $dt++
        }

        my $weekdays = @days.fmt(&quot;%2s&quot;).join: &quot; &quot;;
        say center(@months[$month-1] ~ &quot; &quot; ~ $year, $weekdays.chars);
        say $weekdays;
        for @slots.kv -&amp;gt; $k, $v {
            print &quot;$v &quot;;
            print &quot;\n&quot; if ($k+1) %% 7 or $v == $days-in-month;
        }
    }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Normally, cal(1) will highlight today's date on the calendar. That's a feature I left out of my calendar implementation but it could easily be added with &lt;a href=&quot;https://github.com/tadzik/perl6-Term-ANSIColor/&quot;&gt;Term::ANSIColor&lt;/a&gt;. Also, there's a little bit of coupling between the data being generated in the slots and the output processing (the slots are all formatted to be 2 characters wide in anticipation of the output). There are some other improvements that could be done, but for a first cut at a calendar in Perl 6, I'm happy. :-)&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1841/&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/1841/&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=1841&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">Day 23 – Macros</title>
		<link href="http://perl6advent.wordpress.com/2012/12/23/day-23-macros/"/>
		<id>http://perl6advent.wordpress.com/?p=1856</id>
		<updated>2012-12-23T17:07:05+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Syntactic macros. The Lisp gods of yore provided humanity with this invention, essentially making Lisp a programmable programming language. Lisp adherents often look at the rest of the programming world with pity, seeing them fighting to invent wheels that were wrought and polished back in the sixties when giants walked the Earth and people wrote code in all-caps.&lt;/p&gt;
&lt;p&gt;And the Lisp adherents see that the rest of us haven’t even gotten to the best part yet, the part with syntactic macros. We’re starting to get the hang of automatic memory management, continuations, and useful first-class functions. But macros are still absent from this picture.&lt;/p&gt;
&lt;p&gt;In part, this is because in order to have proper syntactic macros, you basically have to look like Lisp. You know, with the parentheses and all. Lisp ends up having almost no syntax at all, making every program a very close representation of a syntax tree. Which really helps when you have macros starting to manipulate those same trees. Other languages, not really wanting to look like Lisp, find it difficult-to-impossible to pull off the same trick.&lt;/p&gt;
&lt;p&gt;The Perl languages love the difficult-to-impossible. Perl programmers publish half a dozen difficult-to-impossible solutions to CPAN &lt;em&gt;before&lt;/em&gt; breakfast. And, because Perl 6 is awesome and syntactic macros are awesome, Perl 6 has syntactic macros.&lt;/p&gt;
&lt;p&gt;It is known, Khaleesi.&lt;/p&gt;
&lt;h2&gt;What are macros?&lt;/h2&gt;
&lt;p&gt;For reasons even I don’t fully understand, I’ve put myself in charge of implementing syntactic macros in Rakudo. Implementing macros means understanding them. Understanding them means my brain melts regularly. Unless it fries. It’s about 50-50.&lt;/p&gt;
&lt;p&gt;I have this habit where I come into the &lt;code&gt;#perl6&lt;/code&gt; channel, and exclaiming “macros are just X!” for various values of X. Here are some samples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Macros are just syntax tree manipulators.&lt;/li&gt;
&lt;li&gt;Macros are just “little compilers”.&lt;/li&gt;
&lt;li&gt;Macros are just a kind of templates.&lt;/li&gt;
&lt;li&gt;Macros are just routines that do code substitution.&lt;/li&gt;
&lt;li&gt;Macros allow you to safely hand values back and forth between the compile-time world and the runtime world.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But the definition that I finally found that I like best of all comes from &lt;a href=&quot;http://scalamacros.org/&quot;&gt;scalamacros.org&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Macros are functions that are called by the compiler during compilation. Within these functions the programmer has access to compiler APIs. For example, it is possible to generate, analyze and typecheck code.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;While we only cover the “generate” part of it yet in Perl 6, there’s every expectation we’ll be getting to the “analyze and typecheck” parts as well.&lt;/p&gt;
&lt;h2&gt;Some examples, please?&lt;/h2&gt;
&lt;p&gt;Coming right up.&lt;/p&gt;
&lt;pre&gt;macro checkpoint {
  my $i = ++(state $n);
  quasi { say &quot;CHECKPOINT $i&quot;; }
}

checkpoint;
for ^5 { checkpoint; }
checkpoint;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;quasi&lt;/code&gt; block is Perl 6′s way of saying “a piece of code, coming right up!”. You just put your code in the &lt;code&gt;quasi&lt;/code&gt; block, and return it from the macro routine.&lt;/p&gt;
&lt;p&gt;This code inserts “checkpoints” in our code, like little debugging messages. There’s only three checkpoints in the code, so the output we’ll get looks like this:&lt;/p&gt;
&lt;pre&gt;CHECKPOINT 1
CHECKPOINT 2
CHECKPOINT 2
CHECKPOINT 2
CHECKPOINT 2
CHECKPOINT 2
CHECKPOINT 3&lt;/pre&gt;
&lt;p&gt;Note that the “code insertion” happens at compile time. That’s why we get five copies of the &lt;code&gt;CHECKPOINT 2&lt;/code&gt; line, because it’s the same checkpoint running five times. If we had had a subroutine instead:&lt;/p&gt;
&lt;pre&gt;sub checkpoint {
  my $i = ++(state $n);
  say &quot;CHECKPOINT $i&quot;;
}&lt;/pre&gt;
&lt;p&gt;Then the program would print 7 distinct checkpoints.&lt;/p&gt;
&lt;pre&gt;CHECKPOINT 1
CHECKPOINT 2
CHECKPOINT 3
CHECKPOINT 4
CHECKPOINT 5
CHECKPOINT 6
CHECKPOINT 7&lt;/pre&gt;
&lt;p&gt;As a more practical example, let’s say you have logging output in your program, but you want to be able to switch it off completely. The problem with an ordinary logging subroutine is that with something like:&lt;/p&gt;
&lt;pre&gt;LOG &quot;The answer is { time-consuming-computation() }&quot;;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;time-consuming-computation()&lt;/code&gt; will run and take a lot of time even if &lt;code&gt;LOG&lt;/code&gt; subsequently finds that logging was turned off. (That’s just how argument evaluation works in a non-lazy language.)&lt;/p&gt;
&lt;p&gt;A macro fixes this:&lt;/p&gt;
&lt;pre&gt;constant LOGGING = True;

macro LOG($message) {
  if LOGGING {
    quasi { say {{{$message}}} };
  }
}&lt;/pre&gt;
&lt;p&gt;Here we see a new feature: the &lt;code&gt;{{{ }}}&lt;/code&gt; triple-block. (Syntax is likely to change in the near future, see below.) It’s our way to mix template code in the &lt;code&gt;quasi&lt;/code&gt; block with code coming in from other places. Doing &lt;code&gt;say $message;&lt;/code&gt; would have been wrong, because &lt;code&gt;$message&lt;/code&gt; is a syntax tree of the message to be logged. We need to inject that syntax tree right into the &lt;code&gt;quasi&lt;/code&gt;, and we do that with a triple-block.&lt;/p&gt;
&lt;p&gt;The macro &lt;em&gt;conditionally&lt;/em&gt; generates logging code in your program. If the constant &lt;code&gt;LOGGING&lt;/code&gt; is switched on, the appropriate logging code will replace each &lt;code&gt;LOG&lt;/code&gt; macro invocation. If &lt;code&gt;LOGGING&lt;/code&gt; is off, each macro invocation will be replaced by literally nothing.&lt;/p&gt;
&lt;p&gt;Experience shows that running no code at all is very efficient.&lt;/p&gt;
&lt;h2&gt;What are syntactic macros?&lt;/h2&gt;
&lt;p&gt;A lot of things are called “macros” in this world. In programming languages, there are two big categories:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Textual macros.&lt;/strong&gt; They substitute code on the level of the source code text. C’s macros, or Perl 5′s source filters, are examples.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Syntactic macros.&lt;/strong&gt; They substitute code on the level of the source code syntax tree. Lisp macros are an example.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Textual macros are very powerful, but they represent the kind of power that is just as likely to shoot half your leg off as it is to get you to your destination. Using them requires great care, of the same kind needed for a janitor gig at Jurassic Park.&lt;/p&gt;
&lt;p&gt;The problem is that textual macros don’t &lt;em&gt;compose&lt;/em&gt; all that well. Bring in more than one of them to work on the same bit of source code, and… all bets are off. This puts severe limits on modularity. Textual macros, being what they are, leak internal details all over the place. This is the big lesson from Perl 5′s source filters, as far as I understand.&lt;/p&gt;
&lt;p&gt;Syntactic macros compose wonderfully. The compiler is &lt;em&gt;already&lt;/em&gt; a pipeline handing off syntax trees between various processing steps, and syntactic macros are simply more such steps. It’s as if you and the compiler were two children, with the compiler going “Hey, you want to play in my sandbox? Jump right in. Here’s a shovel. We’ve got work to do.” A macro is a shovel.&lt;/p&gt;
&lt;p&gt;And syntactic macros allow us to be &lt;em&gt;hygienic&lt;/em&gt;, meaning that code in the macro and code outside of the macro don’t step on each other’s toes. In practice, this is done by carefully keeping track of the macros context and the mainline’s context, and making sure wires don’t cross. This is necessary for safe and large-scale composition. Textual macros don’t give us this option at all.&lt;/p&gt;
&lt;h2&gt;Future&lt;/h2&gt;
&lt;p&gt;Both of the examples in this post work already in Rakudo. But it might also be useful to know where we’re heading with macros in the next year or so. The list is in the approximate order I expect to tackle things.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Un-hygiene.&lt;/strong&gt; While hygienic macros are the sane and preferable default, sometimes you &lt;em&gt;want&lt;/em&gt; to step on the toes of the mainline code. There should be an opt-out, and escape hatch. This is next up.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Introspection.&lt;/strong&gt; In order to analyze and typecheck code, not just generate it, we need to be able to take syntax trees coming in as macro arguments, and look inside of them. There are no tools for that yet, and there’s no spec to guide us here. But I’m fairly sure people will want this. The trick is to come up with something that doesn’t tie us down to one compiler’s internal syntax-tree format. Both for the sake of compiler interoperability and future compatibility.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deferred declarations.&lt;/strong&gt; The sandbox analogy isn’t so frivolous, really. If you declare a class inside a &lt;code&gt;quasi&lt;/code&gt; block, that declaration is limited (“sandboxed”) to within that &lt;code&gt;quasi&lt;/code&gt; block. Then, when the code is injected somewhere in the mainline because of a macro invocation, it should actually run. Fortunately, as it happens, the Rakudo internals are factored in such a way that this will be fairly straightforward to implement.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Better syntax.&lt;/strong&gt; The triple-block syntax is probably going away in favor of something better. The problem isn’t the syntax so much as the fact that it currently only works for terms. We want it to work for basically all syntactic categories. A solid proposal for this is yet to materialize, though.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With each of these steps, I expect us to find new and fruitful uses of macros. Knowing my fellow Perl 6 developers, we’ll probably find some uses that will shock and disgust us all, too.&lt;/p&gt;
&lt;h2&gt;In conclusion&lt;/h2&gt;
&lt;p&gt;Perl 6 is awesome because it puts &lt;em&gt;you&lt;/em&gt;, the programmer, in the driver seat. Macros are simply more of that.&lt;/p&gt;
&lt;p&gt;Implementing macros makes your brain melt. However, using them is relatively straightforward.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1856/&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/1856/&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=1856&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">Threads for Rakudo Perl 6</title>
		<link href="http://ttjjss.wordpress.com/2012/12/22/threads-for-rakudo-perl-6/"/>
		<id>http://ttjjss.wordpress.com/?p=207</id>
		<updated>2012-12-22T10:36:54+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;So it has come to this. &lt;a href=&quot;https://github.com/tadzik/Threads&quot;&gt;Threads.pm&lt;/a&gt; is up and running, bringing the ever-wanted threaded execution to the most popular Perl 6 implementation.&lt;/p&gt;
&lt;p&gt;You’re looking for TL;DR, aren’t you? Here’s what it’s capable of:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;use Threads;
use Semaphore;

my @elements;
my $free-slots = Semaphore.new(value =&amp;gt; 10);
my $full-slots = Semaphore.new(value =&amp;gt; 0);

sub produce($id) {
    my $i = 0;
    loop {
        $free-slots.wait;
        @elements.push: $i;
        $i++;
        $full-slots.post;
    }
}

sub consume($id) {
    loop {
        $full-slots.wait;
        my $a = @elements.shift;
        $free-slots.post;
    }
}

for 1..5 -&amp;gt; $i {
    async sub { produce($i)  }
}

for 5..10 -&amp;gt; $i {
    async sub { consume($i) }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Doesn’t look &lt;em&gt;that&lt;/em&gt; awesome. I mean, it’s just a producer-consumer problem, what’s the big deal? Let me repeat:&lt;/p&gt;
&lt;p&gt;OMG, RAKUDO HAS WORKING THREADS.&lt;/p&gt;
&lt;p&gt;So, once we’re done celebrating and dancing macarena all around, there’ll always be someone to ask “hold on, there’s gotta be a caveat. Something surely is missing, explain yourself!”&lt;/p&gt;
&lt;p&gt;I’ll be delighted to say “nope, everything’s there!”, but that’d make me a liar. Yeah, there are missing pieces. First, those aren’t really native threads – just green threads. Native OS threads are already implemented in Parrot VM, but NQP (the language that Rakudo is based on) still doesn’t support them, so before some volunteer comes along to fix them, you’ll still have to build parrot &lt;code&gt;--without-threads&lt;/code&gt; (which means: use green threads, not OS threads) for Threads.pm to work. But fear not! The API is exactly the same, so once native threads are there, both Threads.pm and the code you write with it should work without any changes.&lt;/p&gt;
&lt;p&gt;But green threads are fine too! Except for one minor detail: whenever any of them blocks on IO, the entire Parrot comes to a halt. The plan is for Parrot threads scheduler to handle it nicely, but it’s not there yet, so if you expected nice and easy async IO, sorry, but you’re stuck on &lt;a href=&quot;https://github.com/tadzik/MuEvent&quot; title=&quot;MuEvent on github&quot;&gt;MuEvent&lt;/a&gt; :)&lt;/p&gt;
&lt;p&gt;Yep, we’re not &lt;em&gt;really&lt;/em&gt; there yet. But I claim it’s closer than ever. We have working threads implementation. You can write code with that, and it’s not a PITA. Go for it! There’s a lot of room to improve it. I didn’t try really hard for Threads.pm to follow the concurrency synopsis (in my defense, I think niecza doesn’t follow it either :)), and I think that once we unleash a wolfpack of developers which can work towards something that we’ll all love to use.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/ttjjss.wordpress.com/207/&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/207/&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=207&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 changes - 2012W51</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2012W51.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2012W51.html</id>
		<updated>2012-12-22T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;TODO: Insert the description of changes. Also, mention that Rakudo 2012.12 (Warszawa) was released and that Rakudo isn’t Rakudo Star.&lt;/p&gt; id='incompatible_changes'&amp;gt;Incompatible changes&amp;gt;&lt;h2 id=&quot;rakudo_perl_in_rakudo_201212&quot;&gt;Rakudo Perl (in Rakudo 2012.12)&amp;gt;&lt;ul&gt;
&lt;li&gt;When disambiguating hash/block, and &lt;code&gt;$_&lt;/code&gt; variable is used, Rakudo assumes block. This could break your code if you were expecting a hash.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl_post_rakudo_201212&quot;&gt;Rakudo Perl (post Rakudo 2012.12)&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;my $a; { $a; my $a }&lt;/code&gt; is an error.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;for&lt;/code&gt; runs in sink (void) or list context, just like &lt;code&gt;map&lt;/code&gt; (actually, &lt;code&gt;for&lt;/code&gt; does exactly what &lt;code&gt;map&lt;/code&gt; does). If you were depending on it, you can use &lt;code&gt;eager do&lt;/code&gt; before &lt;code&gt;for&lt;/code&gt; to force eager execution.&lt;/li&gt;
&lt;/ul&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl_in_rakudo_201212&quot;&gt;Rakudo Perl (in Rakudo 2012.12)&amp;gt;&lt;ul&gt;
&lt;li&gt;Added &lt;code&gt;X::Comp::Group&lt;/code&gt; exception. It’s used when compilation can produce multiple issues.&lt;/li&gt;

&lt;li&gt;Added support for warnings. Code like &lt;code&gt;my ($a, $a);&lt;/code&gt; only causes warnings, not fatal errors.&lt;/li&gt;

&lt;li&gt;Added &lt;code&gt;X::Undeclared::Symbols&lt;/code&gt; exception for variables that weren’t declared, but used.&lt;/li&gt;

&lt;li&gt;You can use &lt;code&gt;.message&lt;/code&gt; on &lt;code&gt;Exception&lt;/code&gt;s.&lt;/li&gt;

&lt;li&gt;Fixed &lt;code&gt;.perl&lt;/code&gt; output for a &lt;code&gt;Pair&lt;/code&gt; that has key that is a &lt;code&gt;Pair&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;X::Item&lt;/code&gt; is thrown for &lt;code&gt;@a[NaN]&lt;/code&gt; or &lt;code&gt;@a[Inf]&lt;/code&gt;. It isn’t incompatible change because it wasn’t working before anyway.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 22 – Parsing an IPv4 address</title>
		<link href="http://perl6advent.wordpress.com/2012/12/22/day-22-parsing-an-ipv4-address/"/>
		<id>http://perl6advent.wordpress.com/?p=1813</id>
		<updated>2012-12-22T00:01:22+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;&lt;em&gt;Guest post by Herbert Breunung (lichtkind).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Perl 5 brought regexes to mainstream programming and set a standard, one that is felt as relevant even in Redmond. Perl 6, of course, steps up the game by adding many new features to the regex camp, including &lt;a href=&quot;http://perl6advent.wordpress.com/2009/12/21/day-21-grammars-and-actions&quot;&gt;easy-to-build grammars&lt;/a&gt; for your own complex parsers. But without getting too complex, you can get a lot of joy out of Perl 6′s &lt;code&gt;rx&lt;/code&gt;  (that’s how Perl 6 spells Perl 5′s &lt;code&gt;qr&lt;/code&gt; operator, that enables you to save a Regex in a variable).&lt;/p&gt;
&lt;p&gt;Because the Perl 6 regex syntax is less littered with exceptional cases, Larry Wall also likes to joke that he put the “regular” back into “regular expression”.&lt;/p&gt;
&lt;p&gt;Some of the changes are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;most special variables are gone,&lt;/li&gt;
&lt;li&gt;non-capturing groups and other grouping syntax is easier to type,&lt;/li&gt;
&lt;li&gt;no more single/multi line modes,&lt;/li&gt;
&lt;li&gt;x mode became default, making whitespace non-significant by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In summary, regexes are more regular than in Perl 5, confirming Larry’s joke. They try a bit harder to make your life easier when you need to match text. Under the hood, regexes have blossomed out into a complete sub-language within the bigger Perl 6 language. A language with its own parsing rules.&lt;/p&gt;
&lt;p&gt;But don’t fret; not everything has changed. Some things remain the same:&lt;/p&gt;
&lt;pre&gt;/\d+/&lt;/pre&gt;
&lt;p&gt;This regex still matches one or more consecutive digits.&lt;/p&gt;
&lt;p&gt;Similarly, if you want to capture the digits, you can do this, just like you’re used to:&lt;/p&gt;
&lt;pre&gt;/(\d+)/&lt;/pre&gt;
&lt;p&gt;You’ll find the matched digits in &lt;code&gt;$0&lt;/code&gt;, not &lt;code&gt;$1&lt;/code&gt; as in Perl 5. All the special variables &lt;code&gt;$0&lt;/code&gt;, &lt;code&gt;$1&lt;/code&gt;, &lt;code&gt;$2&lt;/code&gt; are really syntactic sugar for indexing the &lt;em&gt;match variable&lt;/em&gt; (&lt;code&gt;$/[0]&lt;/code&gt;, &lt;code&gt;$/[1]&lt;/code&gt;, &lt;code&gt;$/[2]&lt;/code&gt;). Because indices start at 0, it makes sense for the first matched group to be &lt;code&gt;$0&lt;/code&gt;. In Perl 5, &lt;code&gt;$0&lt;/code&gt; contains the name of the script or program, but this has been renamed into &lt;code&gt;$*EXECUTABLE_NAME&lt;/code&gt; in Perl 6.&lt;/p&gt;
&lt;p&gt;Should you be interested in getting all of the captured groups of a regex match, you can use &lt;code&gt;@()&lt;/code&gt;, which is syntactic sugar for &lt;code&gt;@($/)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The object in the &lt;code&gt;$/&lt;/code&gt; variable holds lots of useful information about the last match. For example, &lt;code&gt;$/.from&lt;/code&gt; will give you the starting string position of the match.&lt;/p&gt;
&lt;p&gt;But &lt;code&gt;$0&lt;/code&gt; will get us far enough for this post. We use it to extract individual features from a string.&lt;/p&gt;
&lt;p&gt;Sometimes we want to extract a whole bunch of similar things at once. Then we can use the &lt;code&gt;:g&lt;/code&gt; (or &lt;code&gt;:global&lt;/code&gt;) modifier on the regex:&lt;/p&gt;
&lt;pre&gt;$_ = '1 23 456 78.9';
say .Str for m:g/(\d+)/; # 1 23 456 78 9&lt;/pre&gt;
&lt;p&gt;Note that the &lt;code&gt;:g&lt;/code&gt; — as opposed to prior regex implementations — sits up front, right at the start of the regex. Not at the end. That way, when you read the regex from left to right, you will know from the start how the regex is doing its matching. No more end-heavy regex expressions.&lt;/p&gt;
&lt;p&gt;Matching “all things that look like this” is so useful, that there’s even a dedicated method for that, &lt;code&gt;.comb&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;$str.comb(/\d+/);&lt;/pre&gt;
&lt;p&gt;If you’re familiar with &lt;code&gt;.split&lt;/code&gt;, you can think of &lt;code&gt;.comb&lt;/code&gt; as its cheerful cousin, matching all the things that &lt;code&gt;.split&lt;/code&gt; discards.&lt;/p&gt;
&lt;p&gt;Let’s tackle the matching of an IPv4 address. Coming from a Perl 5 angle, we expect to have to do something like this:&lt;/p&gt;
&lt;pre&gt;/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/&lt;/pre&gt;
&lt;p&gt;This won’t do in Perl 6, though. First of all, the &lt;code&gt;{}&lt;/code&gt; blocks are real blocks in a Perl 6 regex; they contain Perl 6 code. Second, because Perl 6 has lots of error handling to catch p5isms, like this, you’ll get an error saying “Unsupported use of {N,M} as general quantifier; in Perl 6 please use ** N..M (or ** N..*)”.&lt;/p&gt;
&lt;p&gt;So let’s do that. To match between one and three digits in a Perl 6 regex, we should type:&lt;/p&gt;
&lt;pre&gt;/\d ** 1..3/&lt;/pre&gt;
&lt;p&gt;Note how the regex sublanguage re-uses parts from the main Perl 6 language. &lt;code&gt;**&lt;/code&gt; can be seen as a kind of exponentiation (if we squint), in that we’re taking &lt;code&gt;\d&lt;/code&gt; “to the between-first-and-third power”. And the range notation &lt;code&gt;1..3&lt;/code&gt; exists both outside and within regexes.&lt;/p&gt;
&lt;p&gt;Using our new knowledge about the repetition quantifier, we end up with something like this:&lt;/p&gt;
&lt;pre&gt;/(\d**1..3) \. (\d**1..3) \. (\d**1..3) \. (\d**1..3)/&lt;/pre&gt;
&lt;p&gt;That’s still kinda clunky. We might end up wishing that we could use the repetition operator again, but those literal dots in between prevent us from doing that. If only we could specify repetition a given number of times &lt;em&gt;and&lt;/em&gt; a divider.&lt;/p&gt;
&lt;p&gt;In Perl 6 regexes, you can.&lt;/p&gt;
&lt;pre&gt;/ (\d ** 1..3) ** 4 % '.' /&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;%&lt;/code&gt; operator here is a &lt;em&gt;quantifier modifier&lt;/em&gt;, so it can only follow on a quantifier like &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;**&lt;/code&gt;. The choice of &lt;code&gt;%&lt;/code&gt; for this function is relatively new in Perl 6, and you may prefer to read it as “modulo”, just like in the main language. That is, “match four groups of digits, modulo literal dots in between”. Or you could think of the dots in between as the “remainder”, the separators that are left after you’ve parsed the actual elements.&lt;/p&gt;
&lt;p&gt;Oh, and you might’ve noticed that &lt;code&gt;\.&lt;/code&gt; changed to &lt;code&gt;'.'&lt;/code&gt; on the way. We can use either; they mean exactly the same. In Perl 5, there isn’t a simple rule saying which symbols have a magic meaning and which ones simply signify themselves. In Perl 6, it’s easy: word characters (alphanumerics and the underscore) always signify themselves. Everything else has to be escaped or quoted to get its literal meaning.&lt;/p&gt;
&lt;p&gt;Putting it all together, here’s how we would extract IPv4 addresses out of a string:&lt;/p&gt;
&lt;pre&gt;$_ = &quot;Go 127.0.0.1, I said! He went to 173.194.32.32.&quot;;

say .Str for m:g/ (\d ** 1..3) ** 4 % '.' /;
# output: 127.0.0.1 173.194.32.32&lt;/pre&gt;
&lt;p&gt;Or, we could use &lt;code&gt;.comb&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;$_ = &quot;Go 127.0.0.1, I said! He went to 173.194.32.32.&quot;;
my @ip4addrs = .comb(/ (\d ** 1..3) ** 4 % '.' /);&lt;/pre&gt;
&lt;p&gt;If we’re interested in individual integers, we can get those too:&lt;/p&gt;
&lt;pre&gt;$_ = &quot;Go 127.0.0.1, I said! He went to 173.194.32.32.&quot;;
say .list&amp;gt;&amp;gt;.Str.perl for m:g/ (\d ** 1..3) ** 4 % '.' /;
# output: (&quot;127&quot;, &quot;0&quot;, &quot;0&quot;, &quot;1&quot;) (&quot;173&quot;, &quot;194&quot;, &quot;32&quot;, &quot;32&quot;)&lt;/pre&gt;
&lt;p&gt;If you want to know more, read &lt;a href=&quot;http://perlcabal.org/syn/S05.html&quot;&gt;the S05&lt;/a&gt;, or watch me battling with my slide deck and the English language in &lt;a href=&quot;http://www.youtube.com/watch?v=6Q19mbOtk3c&quot;&gt;this presentation about regexes&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1813/&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/1813/&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=1813&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">Day 21 – Collatz Variations</title>
		<link href="http://perl6advent.wordpress.com/2012/12/21/day-21-collatz-variations/"/>
		<id>http://perl6advent.wordpress.com/?p=1790</id>
		<updated>2012-12-21T12:25:40+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Collatz_conjecture&quot;&gt;Collatz sequence&lt;/a&gt; is one of those interesting “simple” math problems that I’ve run into a number of times.  Most recently a blog post on &lt;a href=&quot;http://blog.racket-lang.org/2012/10/the-3n1-problem_4990.html&quot;&gt;programming it in Racket&lt;/a&gt; showed up on Hacker News.  As happens so often, I instantly wanted to implement it in Perl 6.&lt;/p&gt;
&lt;pre class=&quot;brush: plain; light: true; title: ; notranslate&quot;&gt;sub collatz-sequence(Int $start) { 
    $start, { when * %% 2 { $_ / 2 }; when * !%% 2 { 3 * $_ + 1 }; } ... 1;
}

sub MAIN(Int $min, Int $max) {
    say [max] ($min..$max).map({ +collatz-sequence($_) });        
}
&lt;/pre&gt;
&lt;p&gt;This is a very straightforward implementation of the Racket post’s &lt;code&gt;max-cycle-length-range&lt;/code&gt; as a stand-alone p6 script.  &lt;code&gt;collatz-sequence&lt;/code&gt; generates the sequence using the p6 sequence operator.  Start with the given number.  If it is divisible by two, do so: &lt;code&gt;when * %% 2 { $_ / 2 }&lt;/code&gt;.  If it is not, multiply by three and add 1: &lt;code&gt;when * !%% 2 { 3 * $_ + 1 }&lt;/code&gt;.  Repeat this until the sequence reaches 1.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;MAIN(Int $min, Int $max)&lt;/code&gt; sets up our main function to take two integers.  Many times I don’t bother with argument types in p6, but this provides a nice feedback for users:&lt;/p&gt;
&lt;pre class=&quot;brush: plain; light: true; title: ; notranslate&quot;&gt;&amp;gt; perl6 collatz.pl blue red
Usage:
  collatz.pl &amp;lt;min&amp;gt; &amp;lt;max&amp;gt; 
&lt;/pre&gt;
&lt;p&gt;The core of it just maps the numbers from &lt;code&gt;$min&lt;/code&gt; to &lt;code&gt;$max&lt;/code&gt; (inclusive) to the length of the sequence (&lt;code&gt;+collatz-sequence&lt;/code&gt;) and then says the max of the resulting list (&lt;code&gt;[max]&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Personally I’m a big fan of using the sequence operator for tasks like this; it directly represents the algorithm constructing the Collatz sequence in a simple and elegant fashion.  On the other hand, you should be able to memoize the recursive version for a speed increase.  Maybe that would give it an edge over the sequence operator version?&lt;/p&gt;
&lt;p&gt;Well, I was wildly wrong about that.&lt;/p&gt;
&lt;pre class=&quot;brush: plain; light: true; title: ; notranslate&quot;&gt;sub collatz-length($start) {
    given $start {
        when 1       { 1 }
        when * !%% 2 { 1 + collatz-length(3 * $_ + 1) } 
        when * %% 2  { 1 + collatz-length($_ / 2) } 
    }
}

sub MAIN($min, $max) {
    say [max] ($min..$max).map({ collatz-length($_) });        
}
&lt;/pre&gt;
&lt;p&gt;This recursive version, which makes no attempt whatsoever to be efficient, is actually better than twice as fast as the sequence operator version.  In retrospect, this makes perfect sense: I was worried about the recursive version making a function call for every iteration, but the sequence version has to make two, one to calculate the next iteration and the other to check and see if the ending condition has been reached.&lt;/p&gt;
&lt;p&gt;Well, once I’d gotten this far, I thought I’d better do things correctly.  I wrote two framing scripts, one for timing all the available scripts, the other for testing them to make sure they work!&lt;/p&gt;
&lt;pre class=&quot;brush: plain; light: true; title: ; notranslate&quot;&gt;my @numbers = 1..200, 10000..10200;

sub MAIN(Str $perl6, *@scripts) {
    my %results;
    for @scripts -&amp;gt; $script {
        my $start = now;
        qqx/$perl6 $script { @numbers }/;
        my $end = now;

        %results{$script} = $end - $start;
    }

    for %results.pairs.sort(*.value) -&amp;gt; (:key($script), :value($time)) {
        say &quot;$script: $time seconds&quot;;
    }
}
&lt;/pre&gt;
&lt;p&gt;This script takes as an argument a string that can be used to call a Perl 6 executable and a list of scripts to run.  It runs the scripts using the specified executable, and times them using p6′s &lt;code&gt;now&lt;/code&gt; function.  It then sorts the results into order and prints them.  (A &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/testing-harness.pl&quot;&gt;similar script&lt;/a&gt; I won’t post here tests each of them to make sure they are returning correct results.)&lt;/p&gt;
&lt;p&gt;In the new framework, the Collatz script has changed a bit.  Instead of taking a min and a max value and finding the longest Collatz sequence generated by a number in that range, it takes a series of numbers and generates and reports the length of the sequence for each of them.  Here’s the sequence operator script in its full new version:&lt;/p&gt;
&lt;pre class=&quot;brush: plain; light: true; title: ; notranslate&quot;&gt;sub collatz-length(Int $start) { 
    +($start, { when * %% 2 { $_ / 2 }; when * !%% 2 { 3 * $_ + 1 }; } ... 1);
}

sub MAIN(*@numbers) {
    for @numbers -&amp;gt; $n {
        say &quot;$n: &quot; ~ collatz-length($n.Int);
    }
}
&lt;/pre&gt;
&lt;p&gt;For the rest of the scripts I will skip the &lt;code&gt;MAIN&lt;/code&gt; sub, which is exactly the same in each of them.&lt;/p&gt;
&lt;p&gt;Framework established, I redid the recursive version starting from the new sequence operator code.&lt;/p&gt;
&lt;pre class=&quot;brush: plain; light: true; title: ; notranslate&quot;&gt;sub collatz-length(Int $n) {
    given $n {
        when 1       { 1 }
        when * %% 2  { 1 + collatz-length($_ div 2) }
        when * !%% 2 { 1 + collatz-length(3 * $_ + 1) }
    } 
}
&lt;/pre&gt;
&lt;p&gt;The sharp-eyed will notice this version is different from the first recursive version above in two significant ways.  This time I made the argument &lt;code&gt;Int $n&lt;/code&gt;, which instantly turned up a bit of a bug in all implementations thus far: because I used &lt;code&gt;$_ / 2&lt;/code&gt;, most of the numbers in the sequence were actually rationals, not integers!  This shouldn’t change the results, but is probably less efficient than using &lt;code&gt;Int&lt;/code&gt;s.  Thus the second difference about, it now uses &lt;code&gt;$_ div 2&lt;/code&gt; to divide by 2.  This version remains a great improvement over the sequence operator version, running in 4.7 seconds instead of 13.3.  Changing &lt;code&gt; when * !%% 2&lt;/code&gt; to a simple &lt;code&gt;default&lt;/code&gt; shaves another .3 seconds off the running time.&lt;/p&gt;
&lt;p&gt;Once I started wondering how much time was getting eaten up by the &lt;code&gt;when&lt;/code&gt; statements, rewriting that bit using the ternary operator was an obvious choice.&lt;/p&gt;
&lt;pre class=&quot;brush: plain; light: true; title: ; notranslate&quot;&gt;sub collatz-length(Int $start) { 
    +($start, { $_ %% 2 ?? $_ div 2 !! 3 * $_ + 1 } ... 1);
}
&lt;/pre&gt;
&lt;p&gt;Timing results: Basic sequence 13.4 seconds.  Sequence with &lt;code&gt;div&lt;/code&gt; 11.5 seconds.  Sequence with &lt;code&gt;div&lt;/code&gt; and ternary 9.7 seconds.&lt;/p&gt;
&lt;p&gt;That made me wonder what kind of performance I could get from a handcoded loop.&lt;/p&gt;
&lt;pre class=&quot;brush: plain; title: ; notranslate&quot;&gt;sub collatz-length(Int $n is copy) {
    my $length = 1;
    while $n != 1 {
        $n = $n %% 2 ?? $n div 2 !! 3 * $n + 1;
        $length++;
    }
    $length;
}
&lt;/pre&gt;
&lt;p&gt;That’s by far the least elegant of these, I think, but it gets great performance: 3 seconds.&lt;/p&gt;
&lt;p&gt;Switching back to the recursive approach, how about using the ternary operator there?&lt;/p&gt;
&lt;pre class=&quot;brush: plain; light: true; title: ; notranslate&quot;&gt;sub collatz-length(Int $n) {
    return 1 if $n == 1;
    1 + ($n %% 2 ?? collatz-length($n div 2) !! collatz-length(3 * $n + 1));
}
&lt;/pre&gt;
&lt;p&gt;This one just edges out the handcoded loop, 2.9 seconds.&lt;/p&gt;
&lt;p&gt;Can we do better than that?  How about memoization?  &lt;code&gt;is cached&lt;/code&gt; is supposed to be part of Perl 6; neither implementation has it yet, but last year’s &lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/04/traits-meta-data-with-character/&quot;&gt;Advent calendar has a Rakudo implementation&lt;/a&gt; that still works.  Using the last version changed to &lt;code&gt;sub collatz-length(Int $n) is cached {&lt;/code&gt; works nicely, but takes 3.4 seconds to execute.  Apparently the overhead of caching slows it down a bit.  Interestingly, the non-ternary recursive version does speed up with &lt;code&gt;is cached&lt;/code&gt;, from 4.4 seconds to 3.6 seconds.&lt;/p&gt;
&lt;p&gt;Okay, instead of using a generic memoization, how about hand-coding one?&lt;/p&gt;
&lt;pre class=&quot;brush: plain; light: true; title: ; notranslate&quot;&gt;sub collatz-length(Int $n) {
    return 1 if $n == 1;
    state %lengths;
    return %lengths{$n} if %lengths.exists($n);
    %lengths{$n} = 1 + ($n %% 2 ?? collatz-length($n div 2) !! collatz-length(3 * $n + 1));
}
&lt;/pre&gt;
&lt;p&gt;Bingo!  2.7 seconds.&lt;/p&gt;
&lt;p&gt;I’m sure there are lots of other interesting approaches for solving this problem, and encourage people to send them in.  In the meantime, here’s my summary of results so far:&lt;/p&gt;
&lt;table align=&quot;center&quot; border=&quot;1&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;Script&lt;/td&gt;
&lt;td&gt;Rakudo&lt;/td&gt;
&lt;td&gt;Niecza&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-recursive-ternary-hand-cached.pl&quot;&gt; bin/collatz-recursive-ternary-hand-cached.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 2.5 &lt;/td&gt;
&lt;td&gt; 1.7 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-recursive-ternary.pl&quot;&gt; bin/collatz-recursive-ternary.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 3 &lt;/td&gt;
&lt;td&gt; 1.7 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-loop.pl&quot;&gt; bin/collatz-loop.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 3.1 &lt;/td&gt;
&lt;td&gt; 1.7 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-recursive-ternary-cached.pl&quot;&gt; bin/collatz-recursive-ternary-cached.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 3.2 &lt;/td&gt;
&lt;td&gt; N/A &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-recursive-default-cached.pl&quot;&gt; bin/collatz-recursive-default-cached.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 3.5 &lt;/td&gt;
&lt;td&gt; N/A &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-recursive-default.pl&quot;&gt; bin/collatz-recursive-default.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 4.4 &lt;/td&gt;
&lt;td&gt; 1.8 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-recursive.pl&quot;&gt; bin/collatz-recursive.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 4.9 &lt;/td&gt;
&lt;td&gt; 1.9 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-sequence-ternary.pl&quot;&gt; bin/collatz-sequence-ternary.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 9.9 &lt;/td&gt;
&lt;td&gt; 3.3 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-sequence-div.pl&quot;&gt; bin/collatz-sequence-div.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 11.6 &lt;/td&gt;
&lt;td&gt; 3.5 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/collatz-sequence.pl&quot;&gt; bin/collatz-sequence.pl &lt;/a&gt; &lt;/td&gt;
&lt;td&gt; 13.5 &lt;/td&gt;
&lt;td&gt; 3.8 &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The table was generated from &lt;a href=&quot;https://github.com/colomon/perl6-collatz/blob/master/bin/timing-table-generator.pl&quot;&gt;timing-table-generator.pl&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1790/&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/1790/&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=1790&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">Day 20 – Dynamic variables and DSL-y things</title>
		<link href="http://perl6advent.wordpress.com/2012/12/20/day-20-dynamic-variables-and-dsl-y-things/"/>
		<id>http://perl6advent.wordpress.com/?p=1783</id>
		<updated>2012-12-20T00:01:06+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Today, let’s talk about DSLs.&lt;/p&gt;
&lt;h2&gt;Post from the past: a motivating example&lt;/h2&gt;
&lt;p&gt;Two years ago I wrote &lt;a href=&quot;http://strangelyconsistent.org/blog/the-thing-with-nim&quot;&gt;a blog post about Nim&lt;/a&gt;, a game played with piles of stones. I just put in ASCII diagrams of the actual Nim stone piles, telling myself that if I had time, I would put in fancy SVG diagrams, generated with Perl 6.&lt;/p&gt;
&lt;p&gt;Naturally, I didn’t have time. My self-imposed deadline ran out, and I published the post with simple ASCII diagrams.&lt;/p&gt;
&lt;p&gt;But time is ever-regenerative, and there for people who want it. So, let’s generate some fancy SVG diagrams with Perl 6.&lt;/p&gt;
&lt;h2&gt;Have bit array, want SVG&lt;/h2&gt;
&lt;p&gt;What do we need, exactly? Well, a subroutine that takes an array of piles as input and generates an SVG file would be a really good start.&lt;/p&gt;
&lt;p&gt;Let’s take the last “image” in &lt;a href=&quot;http://strangelyconsistent.org/blog/the-thing-with-nim&quot;&gt;the post&lt;/a&gt; as an example:&lt;/p&gt;
&lt;pre&gt;3      OO O
4 OOOO
5 OOOO    O&lt;/pre&gt;
&lt;p&gt;For the moment, let’s ignore the numbers at the left margin; they’re just counting stones. We summarize the piles themselves as a kind of bitmap, which also forms the input to the function:&lt;/p&gt;
&lt;pre&gt;my @piles =
    [0, 0, 0, 0, 0, 0, 0, 0, 1],
    [1, 1, 1, 1, 0, 1, 1, 0, 1],
    [1, 1, 1, 1, 0, 0, 0, 0, 1];

nim-svg(@piles);&lt;/pre&gt;
&lt;p&gt;At this point, we need only create the &lt;code&gt;nim-svg&lt;/code&gt; function itself, and make it render SVG from this bitmap. Since I’ve long since tired of outputting SVG by hand, I use the &lt;a href=&quot;https://github.com/moritz/svg&quot;&gt;SVG module&lt;/a&gt;, which comes bundled with Rakudo Star.&lt;/p&gt;
&lt;pre&gt;use SVG;

sub nim-svg(@piles) {
    my $width = max map *.elems, @piles;
    my $height = @piles.elems;

    my @elements = gather for @piles.kv -&amp;gt; $row, @pile {
        for @pile.kv -&amp;gt; $column, $is_filled {
            if $is_filled {
                take 'circle' =&amp;gt; [
                    :cx($column + 0.5),
                    :cy($row + 0.5),
                    :r(0.4)
                ];
            }
        }
    }
    
    say SVG.serialize('svg' =&amp;gt; [ :$width, :$height, @elements ]);
}&lt;/pre&gt;
&lt;p&gt;I think you can follow the logic in there. The subroutine simply iterates over the bitmap, turning 1s into circles with appropriate coordinates.&lt;/p&gt;
&lt;h2&gt;That’s it?&lt;/h2&gt;
&lt;p&gt;Well, this will indeed generate an SVG image for us, with the stones correctly placed. But let’s look again at the input that helped create this image:&lt;/p&gt;
&lt;pre&gt;    [0, 0, 0, 0, 0, 0, 0, 0, 1],
    [1, 1, 1, 1, 0, 1, 1, 0, 1],
    [1, 1, 1, 1, 0, 0, 0, 0, 1];&lt;/pre&gt;
&lt;p&gt;Clearly, though we can discern the stones and gaps in there if we squint in a bit-aware programmer’s fashion, the input isn’t… visually attractive. (The zeroes even look like stones, even though they’re gaps!)&lt;/p&gt;
&lt;h2&gt;We can do better&lt;/h2&gt;
&lt;p&gt;Instead of using a bit array, let’s start from the desired SVG image and try to make the input look like that.&lt;/p&gt;
&lt;p&gt;So, this is what I would prefer to write instead of a bitmask:&lt;/p&gt;
&lt;pre&gt;nim {
  _ _ _ _ _ _ _ _ o;
  o o o o _ o o _ o;
  o o o o _ _ _ _ o;
}&lt;/pre&gt;
&lt;p&gt;That’s better. That looks more like my original ASCII diagram, while still being syntactic Perl 6 code.&lt;/p&gt;
&lt;h2&gt;Making a DSL&lt;/h2&gt;
&lt;p&gt;Wikipedia talks about a DSL as a language “dedicated to a particular problem domain”. Well, the above way of specifying the input would be a DSL dedicated to solving the draw-SVG-images-of-Nim-positions domain. (Admittedly a fairly narrow domain. But I’m mostly out to show the potential of DSLs in Perl 6, not to change the world with this particular DSL.)&lt;/p&gt;
&lt;p&gt;Now that we have the desired end state, how do we connect the wires and make the above work? Clearly we need to declare three subroutines: &lt;code&gt;nim&lt;/code&gt;, &lt;code&gt;_&lt;/code&gt;, &lt;code&gt;o&lt;/code&gt;. (Yes, you can name a subroutine &lt;code&gt;_&lt;/code&gt;, no sweat.)&lt;/p&gt;
&lt;pre&gt;sub nim(&amp;amp;block) {
    my @*piles;
    my @*current-pile;

    &amp;amp;block();
    finish-last-pile();
    
    nim-svg(@*piles);
}

sub _(@rest?) {
    unless @rest {
        finish-last-pile();
    }
    @*current-pile = 0, @rest;
    return @*current-pile;
}

sub o(@rest?) {
    unless @rest {
        finish-last-pile();
    }
    @*current-pile = 1, @rest;
    return @*current-pile;
}&lt;/pre&gt;
&lt;h2&gt;Ok… explain, please?&lt;/h2&gt;
&lt;p&gt;A couple of things are going on here.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The two variables &lt;code&gt;@*piles&lt;/code&gt; and &lt;code&gt;@*current-pile&lt;/code&gt; are &lt;em&gt;dynamic variables&lt;/em&gt; which means that they are visible not just in the current lexical scope, but also in all subroutines called before the current scope has finished. Notably, the two subroutines &lt;code&gt;_&lt;/code&gt; and &lt;code&gt;o&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The two subroutines &lt;code&gt;_&lt;/code&gt; and &lt;code&gt;o&lt;/code&gt; take an optional parameter. On each row, the rightmost &lt;code&gt;_&lt;/code&gt; or &lt;code&gt;o&lt;/code&gt; acts as a silent “start of pile” marker, taking the time to do a bit of bookkeeping with the piles, storing away the last pile and starting on a new one.&lt;/li&gt;
&lt;li&gt;Each row in the DSL-y input basically forms a chain of subroutine calls. We take this into account by both incrementally building the &lt;code&gt;@*current-pile&lt;/code&gt; array at each step, all the while returning it as (possible) input for the next subroutine call in the chain.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And that’s it. Oh yeah, we need the bookkeeping routine &lt;code&gt;finish-last-pile&lt;/code&gt;, too:&lt;/p&gt;
&lt;pre&gt;sub finish-last-pile() {
    if @*current-pile {
        push @*piles, [@*current-pile];
    }
    @*current-pile = ();
}&lt;/pre&gt;
&lt;h2&gt;So, it works?&lt;/h2&gt;
&lt;p&gt;Now, the whole thing works. We can turn this DSL-y input:&lt;/p&gt;
&lt;pre&gt;nim {
  _ _ _ _ _ _ _ _ o;
  o o o o _ o o _ o;
  o o o o _ _ _ _ o;
}&lt;/pre&gt;
&lt;p&gt;…into this SVG output:&lt;/p&gt;
&lt;pre&gt;&amp;lt;svg
  xmlns=&quot;http://www.w3.org/2000/svg&quot;
  xmlns:svg=&quot;http://www.w3.org/2000/svg&quot;
  xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;
  width=&quot;9&quot; height=&quot;3&quot;&amp;gt;

  &amp;lt;circle cx=&quot;8.5&quot; cy=&quot;0.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;0.5&quot; cy=&quot;1.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;1.5&quot; cy=&quot;1.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;2.5&quot; cy=&quot;1.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;3.5&quot; cy=&quot;1.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;5.5&quot; cy=&quot;1.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;6.5&quot; cy=&quot;1.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;8.5&quot; cy=&quot;1.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;0.5&quot; cy=&quot;2.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;1.5&quot; cy=&quot;2.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;2.5&quot; cy=&quot;2.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;3.5&quot; cy=&quot;2.5&quot; r=&quot;0.4&quot; /&amp;gt;
  &amp;lt;circle cx=&quot;8.5&quot; cy=&quot;2.5&quot; r=&quot;0.4&quot; /&amp;gt;
&amp;lt;/svg&amp;gt;&lt;/pre&gt;
&lt;p&gt;Yay!&lt;/p&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;The principles I used in this post are fairly easy to generalize. Start from your desired DSL, and create the subroutines to make it happen. Have dynamic variables handle the communication between separate subroutines.&lt;/p&gt;
&lt;p&gt;DSLs are nice because they allow us to shape the code we’re writing around the problem we’re solving. Using relatively little “adapter code”, we’re left to focus on describing and solving problems in a natural way, making the programming language rise to our needs instead of lowering ourselves down to its needs.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1783/&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/1783/&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=1783&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">Parrot 4.11.0 &quot;All together - Happy Birthday Lovebird&quot; Released! by Reini Urban</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/12/msg690.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/12/msg690.html</id>
		<updated>2012-12-19T01:49:52+00:00</updated>
		<content type="html">On behalf of the Parrot team, I'm proud to announce Parrot 4.11.0, also known&lt;br /&gt;as &quot;All together - Happy Birthday Lovebird&quot;.&lt;br /&gt;Parrot (http://parrot.org/) is a virtual machine aimed at running all&lt;br /&gt;dynamic languages.&lt;br /&gt;&lt;br /&gt;Parrot 4.11.0 is available on Parrot's FTP site&lt;br /&gt;(ftp://ftp.parrot.org/pub/parrot/releases/devel/4.11.0/),&lt;br /&gt;or by following the download instructions at http://parrot.org/download.&lt;br /&gt;For those who would like to develop on Parrot, or help develop Parrot&lt;br /&gt;itself, we recommend using&lt;br /&gt;Git to retrieve the source code to get the latest and best Parrot code.&lt;br /&gt;&lt;br /&gt;Threads are considered experimental. There are a known GC bugs when&lt;br /&gt;running large threads&lt;br /&gt;on darwin and sometimes linux. There are no known problems when&lt;br /&gt;running large single-threaded programs.&lt;br /&gt;Reading from shared variables is transparent, writing must be done via&lt;br /&gt;scheduled updater subs&lt;br /&gt;on the owner thread.&lt;br /&gt;You can use the API without using native OS threads by configuring&lt;br /&gt;--without-threads.&lt;br /&gt;&lt;br /&gt;Parrot 4.11.0 News:&lt;br /&gt;    - Core&lt;br /&gt;        + Parrot now supports fast and lightweight OS threads, based&lt;br /&gt;on Nat Tucks's&lt;br /&gt;          initial GSoC work on green threads and then Stefan Seifert's extension&lt;br /&gt;          to true parallel OS threads as hybrid threads.&lt;br /&gt;          See http://wknight8111.blogspot.co.at/2010/08/gsoc-threads-chandons-results.html&lt;br /&gt;          and http://niner.name/Hybrid_Threads_for_the_Parrot_VM.pdf&lt;br /&gt;          Summary:&lt;br /&gt;http://perl6advent.wordpress.com/2012/12/11/day-11-parrot-threads/&lt;br /&gt;        + New parrot cmdline option --numthreads&lt;br /&gt;        + Export new dynpmc_class_&amp;lt;ClassName&amp;gt; types [GH #870].&lt;br /&gt;        + Changed core_ops library format and ops2c to contain the&lt;br /&gt;PBC_COMPAT only,&lt;br /&gt;          not the parrot version triple. Removed the duplicate&lt;br /&gt;PARROT_DYNOP_CORE_INIT&lt;br /&gt;          cpp definition in include/parrot/oplib/core_ops.h, use only&lt;br /&gt;          PARROT_CORE_OPLIB_INIT from config.h&lt;br /&gt;        + Store PBC_MAJOR and PBC_MINOR in the config hash, stored by&lt;br /&gt;auto::revision&lt;br /&gt;        + Added getprotobyname method to the Socket PMC&lt;br /&gt;    - Documentation&lt;br /&gt;        + Marked unused API parameters&lt;br /&gt;        + Install man pages for all binaries&lt;br /&gt;    - Languages&lt;br /&gt;        + nqp-rx tests updated from perl6/nqp-rx.git, and enabled to&lt;br /&gt;run on make test&lt;br /&gt;    - Platforms&lt;br /&gt;        + More compilation fixes on Windows without working mt.exe or&lt;br /&gt;ranlib=rem,&lt;br /&gt;          enable smoking without git binary.&lt;br /&gt;    - Tools&lt;br /&gt;        + Re-enabled pbc_dump -h --header-only&lt;br /&gt;        + Improved pmc2c, added more UNUSED(arg) macros [GH #836].&lt;br /&gt;Parrot is now almost&lt;br /&gt;          -Wunused-parameters safe.&lt;br /&gt;    - Tests&lt;br /&gt;        + failing Pod::Simple pod_todo.t tests are now skipped&lt;br /&gt;        + added nqp-rx tests&lt;br /&gt;        + removed duplicate ext/nqp-rx/t/p6regex tests&lt;br /&gt;        + rewrote and enabled native_pbc tests [GH #394],&lt;br /&gt;          renamed native_pbc testfiles&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SHA256 message digests for the downloadable tarballs are:&lt;br /&gt;46de72022dfe521fb8c5d95453e1d091d4d20d8f7ca4f2ed0cd1420b682f20dc&lt;br /&gt;parrot-4.11.0.tar.gz&lt;br /&gt;0632ad0ca9557df391088bddbbc2608a4503adb5679dcbe62c065a73d4ce49de&lt;br /&gt;parrot-4.11.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 supported release is 15 January 2013.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;-- &lt;br /&gt;Reini Urban&lt;br /&gt;http://cpanel.net/   http://www.perl-compiler.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-2013 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 19 – Gather and/or Coroutines</title>
		<link href="http://perl6advent.wordpress.com/2012/12/19/gather-andor-coroutines/"/>
		<id>http://perl6advent.wordpress.com/?p=1775</id>
		<updated>2012-12-19T00:01:43+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Today I’ll write about coroutines, gather-take and why they are as much fun as one another. But since it’s all about manipulating control flow, I took the liberty to reorganize the control flow of this advent post, so coroutines will finally appear somewhere at the end of it. In the meantime I’ll introduce the backstory, the problems that coroutines solved and how it looks from the Perl 6 kitchen.&lt;/p&gt;
&lt;p&gt;LWP::Simple is all fun and games, but sometimes you can’t afford to wait for the result to come. It would make sense to say “fetch me this webpage and drop me a note when you’re done with it”. That’s non trivial though; LWP::Simple is a black box, which we tell “get() this, get() that” and it gives us the result back. There is no possible way to intercept the internal data it sends there and around. Or is there?&lt;/p&gt;
&lt;p&gt;If you look at Perl 5′s AnyEvent::HTTP, you’ll see that it reimplemented the entire HTTP client to have it non-blocking. Let’s see if we can do better than that.&lt;/p&gt;
&lt;p&gt;First thing, where does LWP::Simple actually block? Behind our backs it uses the built-in IO::Socket::INET class. When it wants data from it, it calls .read() or .recv() and patiently waits until they’re done. If only we could somehow make it not rely on those two directly, hmm…&lt;/p&gt;
&lt;p&gt;„I know!”, a gemstone-fascinated person would say, „We can monkey-patch IO::Socket::INET”. And then we have two problems. No, we’ll go the other way, and follow the glorious path of Dependency Injection.&lt;/p&gt;
&lt;p&gt;That sounds a bit scary. I’ve heard about as many definitions of Dependency Injection as many people I know. The general idea is to not create objects inside other objects directly; it should be possible to supply them from the outside. I like to compare it to elimination of „magic constants”. No one likes those; if you think of classes as another kind of magic constants which may appear in somebody else’s code, this is pretty much what this is about. In our case it looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# LWP::Simple make_request
my IO::Socket::INET $sock .= new(:$host, :$port);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There we go. “IO::Socket::INET” is the magic constant here; if you want to use a different thing, you’re doomed. Let’s mangle it for a bit and allow the socket class to come from the outside.&lt;/p&gt;
&lt;p&gt;We’ll add an attribute to LWP::Simple, let’s call it $!socketclass&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;has $.socketclass = IO::Socket::INET;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If we don’t supply any, it will just fallback to IO::Socket::INET, which is a sensible default. Then, instead of the previous .new() call, we do&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;my $sock = $!socketclass.new(:$host, :$port);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The actual patch (&lt;a href=&quot;https://github.com/tadzik/perl6-lwp-simple/commit/93c182ac2&quot; rel=&quot;nofollow&quot;&gt;https://github.com/tadzik/perl6-lwp-simple/commit/93c182ac2&lt;/a&gt;) is a bit more complicated, as LWP::Simple supports calling get() not only on constructed objects but also on type objects, which have no attributes set, but we only care about the part shown above. We have an attribute $!socketclass, which defaults to IO::Socket::INET but we’re free to supply another class – dependency-inject it. Cool! So in the end it’ll look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class Fakesocket is IO::Socket::INET {
    method recv($) {
        note 'We intercepted recv()';
        callsame;
    }

    method read($) {
        note 'We intercepted read()';
        callsame;
    }
}

# later
my $lwp = LWP::Simple.new(socketclass =&amp;gt; Fakesocket);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And so our $lwp is a fine-crafted LWP::Simple which could, theorically, give the control flow back to us while it waits for read() and recv() to finish. So, how about we put theory into practice?&lt;/p&gt;
&lt;h3&gt;Here start the actual coroutines, sorry for being late :)&lt;/h3&gt;
&lt;p&gt;What do we really need in our modified recv() and read()? We need a way to say „yeah, if you could just stop executing and give time to someone else, that would be great.” Oh no, but we have no threads! Luckily, we don’t need any. Remember lazy lists?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;my @a := gather { for 1..* -&amp;gt; $n { take $n } }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So on one hand we run an infinite for loop, and on the other we have a way to say „give back what you’ve come up with, I’ll catch up with you later”. That’s what take() does: it temporarily jumps out of the gather block, and is ready to get back to it whenever you want it. Do I hear the sound of puzzles clicking together? That’s exactly what we need! Jump out of the execution flow and wait until we’re asked to continue.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class Fakesocket is IO::Socket::INET {
    method recv($) {
        take 1;
        callsame;
    }

    method read($) {
        take 1;
        callsame;
    }
}

# later
my @a := gather {
    $lwp.get(&quot;http://jigsaw.w3.org/HTTP/300/301.html&quot;);
    take &quot;done&quot;;
}

# give time to LWP::Simple, piece by piece
while ~@a.shift ne &quot;done&quot; {
    say &quot;The coroutine is still running&quot;
}
say &quot;Yay, done!&quot;;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There we go! We just turned LWP::Simple into a non-blocking beast, using almost no black magic at all! Ain’t that cool.&lt;/p&gt;
&lt;p&gt;We now know enough to create some syntactic sugar around it all. Everyone likes sugar.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;module Coroutines;
my @coroutines;
enum CoroStatus &amp;lt;still_going done&amp;gt;;

sub async(&amp;amp;coroutine) is export {
    @coroutines.push($(gather {
        &amp;amp;coroutine();
        take CoroStatus::done;
    }));
}

#= must be called from inside a coroutine
sub yield is export {
    take CoroStatus::still_going;
}

#= should be called from mainline code
sub schedule is export {
    return unless +@coroutines;
    my $r = @coroutines.shift;
    if $r.shift ~~ CoroStatus::still_going {
        @coroutines.push($r);
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We maintain a list of coroutines currently running. Our async() sub just puts a block of code in the execution queue. Then every call to yield() will make it jump back to the mainline code. schedule(), on the other hand, will pick the first available coroutine to be run and will give it some time to do whatever it wants.&lt;/p&gt;
&lt;p&gt;Now, let us wait for the beginning of the post to catch up.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1775/&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/1775/&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=1775&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 18 – Formulas: resistance is futile</title>
		<link href="http://perl6advent.wordpress.com/2012/12/18/day-18-formulas-resistance-is-futile/"/>
		<id>http://perl6advent.wordpress.com/?p=1745</id>
		<updated>2012-12-18T00:01:24+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Today, Perl turns 25: happy birthday Perl! There’s too much to say about this language, its philosophy, its culture, … So here, I would just thank all people who make Perl a success, for such a long time.&lt;/p&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;A formula is “an entity constructed using the &lt;em&gt;symbols&lt;/em&gt; and formation &lt;em&gt;rules&lt;/em&gt; of a given &lt;em&gt;language&lt;/em&gt;“, according to &lt;a href=&quot;http://en.wikipedia.org/wiki/Formula&quot;&gt;Wikipedia&lt;/a&gt; as of this writing. These words sound really familiar for any Perl 6 users who have already played with &lt;a href=&quot;http://perl6advent.wordpress.com/2009/12/24/day-24-the-perl-6-standard-grammar/&quot;&gt;grammars&lt;/a&gt;, however this is not the purpose of this article. Instead, the aim is to demonstrate how the &lt;a href=&quot;http://perl6.org/&quot;&gt;Perl 6&lt;/a&gt; language can be easily extended in order to use formulas &lt;strong&gt;literally&lt;/strong&gt; in the code.&lt;/p&gt;
&lt;p&gt;There are many domains, like Mathematics, Physics, finance, etc., that use their own specific languages. When writing programs for such a domain, it could be less error-prone and simpler to use its specific language instead of using a specific API. For example, someone who has knowledge in electronic may find the formula below:&lt;/p&gt;
&lt;pre&gt;4.7kΩ ± 5%&lt;/pre&gt;
&lt;p&gt;far more understandable than the following piece of code:&lt;/p&gt;
&lt;pre&gt;my $factory MeasureFactory.getSharedInstance();
my $resistance = $factory.createMeasure(value     =&amp;gt; 4700,
                                        unit      =&amp;gt; Unit::ohm,
                                        precision =&amp;gt; 5);&lt;/pre&gt;
&lt;p&gt;The formula &lt;code&gt;4.7kΩ ± 5%&lt;/code&gt; will be used all along this article as an example.&lt;/p&gt;
&lt;h2&gt;Symbol &lt;code&gt;k&lt;/code&gt;: return a modified value&lt;/h2&gt;
&lt;p&gt;Let’s start with the simplest symbol: &lt;code&gt;k&lt;/code&gt;. Basically this is just a multiplier placed after a numeric value. To make the Perl 6 language support this new operator, there’s no need to know much about Perl 6 guts: operators are just funny looking sub-routines:&lt;/p&gt;
&lt;pre&gt;sub postfix:&amp;lt;k&amp;gt; ($a) is tighter(&amp;amp;infix:&amp;lt;*&amp;gt;) { $a * 1000 }&lt;/pre&gt;
&lt;p&gt;This just makes &lt;code&gt;4.7k&lt;/code&gt; return &lt;code&gt;4.7 * 1000&lt;/code&gt;, for example. To be a little bit picky, such kind of multiplier should not be used without a unit (ex. &lt;code&gt;Ω&lt;/code&gt;) and not be coupled to another multiplier (ex. &lt;code&gt;μ&lt;/code&gt;). This would have made this article a little bit more complex, so this is left as an exercise to the reader :) Regarding the &lt;code&gt;tighter&lt;/code&gt; trait, it is already well explained in &lt;a href=&quot;http://perl6advent.wordpress.com/2009/12/22/day-22-operator-overloading/&quot;&gt;three&lt;/a&gt; &lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/22/day-22-operator-overloading-revisited/&quot;&gt;other &lt;/a&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/16/day-16-operator-precedence/&quot;&gt;articles&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Symbols &lt;code&gt;%&lt;/code&gt;: return a closure&lt;/h2&gt;
&lt;p&gt;The next symbol is &lt;code&gt;%&lt;/code&gt;: it is commonly used to compute a ratio of &lt;em&gt;something&lt;/em&gt;, that’s why &lt;code&gt;5%&lt;/code&gt; shouldn’t naively be transformed into &lt;code&gt;0.05&lt;/code&gt;. Instead, it creates a closure that computes the given percent of &lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/03/day-3-whatever-the-layout-manager-is/&quot;&gt;whatever&lt;/a&gt; you want:&lt;/p&gt;
&lt;pre&gt;sub postfix:&amp;lt;%&amp;gt; ($a) is tighter(&amp;amp;infix:&amp;lt;*&amp;gt;) { * * $a / 100 }&lt;/pre&gt;
&lt;p&gt;It’s now possible to write &lt;code&gt;$f = 5%; $f(42)&lt;/code&gt; or &lt;code&gt;5%(42)&lt;/code&gt; directly, and this returns &lt;code&gt;2.1&lt;/code&gt;. It is worth saying this doesn’t conflict with the &lt;code&gt;infix:&amp;lt;%&amp;gt;&lt;/code&gt; operator (modulo), that is, &lt;code&gt;5 % 42&lt;/code&gt; still returns &lt;code&gt;5&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Symbol &lt;code&gt;Ω&lt;/code&gt;: create a new &lt;code&gt;Measure&lt;/code&gt; object&lt;/h2&gt;
&lt;p&gt;Let’s go on with the &lt;code&gt;Ω&lt;/code&gt; symbol. One possibility is to tie the unit and the value in the same object, as in the &lt;code&gt;Measure&lt;/code&gt; class defined below. The &lt;code&gt;ACCEPTS&lt;/code&gt; method is explained later but the idea in this case is that two &lt;code&gt;Measure&lt;/code&gt; objects with two different units can’t match together:&lt;/p&gt;
&lt;pre&gt;enum Unit &amp;lt;volt ampere ohm&amp;gt;;

class Measure {
    has Unit $.unit;
    has $.value;

    method ACCEPTS (Measure:D $a) {
        $!unit == $a.unit &amp;amp;&amp;amp; $!value.ACCEPTS($a.value);
    }
}&lt;/pre&gt;
&lt;p&gt;Then, one operator per unit can be defined in order to &lt;em&gt;hide&lt;/em&gt; the underlying API, that is, to allow &lt;code&gt;4.7kΩ&lt;/code&gt; as an equivalent of &lt;code&gt;Measure.new(value =&amp;gt; 4.7k, unit =&amp;gt; ohm)&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;sub postfix:&amp;lt;V&amp;gt; (Real:D $a) is looser(&amp;amp;postfix:&amp;lt;k&amp;gt;) {
    Measure.new(value =&amp;gt; $a, unit =&amp;gt; volt)
}
sub postfix:&amp;lt;A&amp;gt; (Real:D $a) is looser(&amp;amp;postfix:&amp;lt;k&amp;gt;) {
    Measure.new(value =&amp;gt; $a, unit =&amp;gt; ampere)
}
sub postfix:&amp;lt;Ω&amp;gt; (Real:D $a) is looser(&amp;amp;postfix:&amp;lt;k&amp;gt;) {
     Measure.new(value =&amp;gt; $a, unit =&amp;gt; ohm)
}&lt;/pre&gt;
&lt;p&gt;Regarding the &lt;code&gt;ACCEPTS&lt;/code&gt; method, it is used by &lt;code&gt;~~&lt;/code&gt;, the smartmatch operator, to check if the left operand can &lt;em&gt;match&lt;/em&gt; the right operand, the one with the &lt;code&gt;ACCEPTS&lt;/code&gt; method. In other terms, &lt;code&gt;$a ~~ $b&lt;/code&gt; is equivalent to &lt;code&gt;$b.ACCEPTS($a)&lt;/code&gt;. Typically, this allows the &lt;em&gt;intuitive&lt;/em&gt; comparison between two different types, like scalars and containers for example.&lt;/p&gt;
&lt;p&gt;In this example, this method is overloaded to ensure two &lt;code&gt;Measure &lt;/code&gt;objects can match only if they have the same unit and if their values match. That means &lt;code&gt;4kΩ ~~ 4.0kΩ&lt;/code&gt; is &lt;code&gt;True&lt;/code&gt; whereas &lt;code&gt;4kΩ ~~ 4kV&lt;/code&gt; is &lt;code&gt;False&lt;/code&gt;. Actually, there are many units that &lt;em&gt;can&lt;/em&gt; mix altogether, typically currencies (¥€$) and the ones &lt;a href=&quot;http://en.wikipedia.org/wiki/SI_derived_unit&quot;&gt;derived&lt;/a&gt; from the &lt;cite&gt;International System of Unit&lt;/cite&gt;. But as usual, when something is a little bit more complex, it is left as an exercise to the reader ;)&lt;/p&gt;
&lt;h2&gt;Symbol &lt;code&gt;±&lt;/code&gt;: create a &lt;code&gt;Range&lt;/code&gt; object&lt;/h2&gt;
&lt;p&gt;There’s only one symbol left so far: &lt;code&gt;±&lt;/code&gt;. In the example, it is used to indicate the &lt;a href=&quot;http://en.wikipedia.org/wiki/Electronic_color_code&quot;&gt;tolerance&lt;/a&gt; of the resistance. This tolerance could be either absolute (expressed in &lt;code&gt;Ω&lt;/code&gt;) or relative (expressed in &lt;code&gt;%&lt;/code&gt;), thus the new &lt;code&gt;infix:&amp;lt;±&amp;gt;&lt;/code&gt; operator has several signatures and have to be declared with a &lt;code&gt;multi&lt;/code&gt; keyword. In both cases, the &lt;code&gt;value&lt;/code&gt; is a new &lt;code&gt;Range&lt;/code&gt; objects with the right bounds:&lt;/p&gt;
&lt;pre&gt;multi sub infix:&amp;lt;±&amp;gt; (Measure:D $a, Measure:D $b) is looser(&amp;amp;postfix:&amp;lt;Ω&amp;gt;) {
    die if $a.unit != $b.unit;
    Measure.new(value =&amp;gt; Range.new($a.value - $b.value,
                                   $a.value + $b.value),
                unit =&amp;gt; $a.unit);
}

multi sub infix:&amp;lt;±&amp;gt; (Measure:D $a, Callable:D $b) is looser(&amp;amp;postfix:&amp;lt;Ω&amp;gt;) {
    Measure.new(value =&amp;gt; Range.new($a.value - $b($a.value),
                                   $a.value + $b($a.value)),
                unit =&amp;gt; $a.unit);
}&lt;/pre&gt;
&lt;p&gt;Actually, any &lt;code&gt;Callable&lt;/code&gt; object could be used in the second variant, not only the closures created by the &lt;code&gt;%&lt;/code&gt; operators.&lt;/p&gt;
&lt;p&gt;So far, so good! It’s time to check in the Perl6 REPL interface if everything works fine:&lt;/p&gt;
&lt;pre&gt;&amp;gt; 4.7kΩ ± 1kΩ
Measure.new(unit =&amp;gt; Unit::ohm, value =&amp;gt; 3700/1..5700/1)

&amp;gt; 4.7kΩ ± 5%
Measure.new(unit =&amp;gt; Unit::ohm, value =&amp;gt; 4465/1..4935/1)&lt;/pre&gt;
&lt;p&gt;It looks good, so all the code above ought to be moved into a dedicated &lt;a href=&quot;http://perl6advent.wordpress.com/2009/12/12/day-12-modules-and-exporting/&quot;&gt;module&lt;/a&gt; in order to be re-used at will. Then, a customer could load it and write literally:&lt;/p&gt;
&lt;pre&gt;my $resistance = 4321Ω;
die &quot;resistance is futile&quot; if !($resistance ~~ 4.7kΩ ± 5%);&lt;/pre&gt;
&lt;p&gt;As of this writing, this works both in &lt;a href=&quot;https://github.com/sorear/niecza&quot;&gt;Niecza&lt;/a&gt; and &lt;a href=&quot;http://rakudo.org/&quot;&gt;Rakudo&lt;/a&gt;, the two most advanced implementations of Perl 6.&lt;/p&gt;
&lt;h2&gt;Symbols that aren’t operators&lt;/h2&gt;
&lt;p&gt;Symbols in a formula are not always operators, they can be symbolic constants too, like π. In many languages, constants are just &lt;em&gt;read-only variables&lt;/em&gt;, which sounds definitely weird: a variable isn’t supposed to be … variable? In Perl 6, a constant can be a read-only variable too (hmm) or a &lt;em&gt;read-only term&lt;/em&gt; (this sounds better). For example, to define the constant term &lt;code&gt;φ&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;constant φ = (1 + sqrt(5)) / 2;&lt;/pre&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;In this article the Perl 6 language was slightly extended with several new &lt;em&gt;symbols&lt;/em&gt; in order to embed simple formulas. Although it is possible to go further by changing the Perl 6 grammar in order to embed more specific languages, that is, languages that don’t have the same grammar rules. Indeed, there are already two such languages supported by Perl 6: regexp and &lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/10/day-10-dont-quote-me-on-it/&quot;&gt;quotes&lt;/a&gt;. The same way, Niecza use a &lt;a href=&quot;https://github.com/sorear/niecza/blob/v24/docs/nam.pod&quot;&gt;custom&lt;/a&gt; language to connect its portable parts to the unportable.&lt;/p&gt;
&lt;h2&gt;Bonus: How to type these exotic symbols?&lt;/h2&gt;
&lt;p&gt;Most of the Unicode symbols can be type in Xorg — the most used interface system on Linux — thanks to the &lt;code&gt;Compose&lt;/code&gt; key, also named &lt;code&gt;Multi&lt;/code&gt; key. When this special key is pressed, all the following key-strokes are somewhat merged in order to &lt;a href=&quot;http://en.wikipedia.org/wiki/Compose_key&quot;&gt;compose&lt;/a&gt; a symbol.&lt;/p&gt;
&lt;p&gt;There’s plenty of documentation about this support elsewhere on Internet, so only the minimal information is provided here. First, to map the &lt;code&gt;Compose&lt;/code&gt; key to the &lt;code&gt;Caps Lock&lt;/code&gt; key, write in a X terminal:&lt;/p&gt;
&lt;pre&gt;sh&amp;gt; setxkbmap -option compose:caps&lt;/pre&gt;
&lt;p&gt;Some compositions are likely already defined, for instance &lt;code&gt;&amp;lt;caps&amp;gt;&lt;/code&gt; followed by &lt;code&gt;+&lt;/code&gt; then &lt;code&gt;-&lt;/code&gt; should now produce &lt;code&gt;±&lt;/code&gt;, but both &lt;code&gt;Ω&lt;/code&gt; and &lt;code&gt;φ&lt;/code&gt; are likely not defined. One solution is to write a&lt;br /&gt;
&lt;code&gt;~/.XCompose&lt;/code&gt; file with the following content:&lt;/p&gt;
&lt;pre&gt;include &quot;%L&quot; # Don't discard the current locale setting.

&amp;lt;Multi_key&amp;gt; &amp;lt;o&amp;gt; &amp;lt;h&amp;gt; &amp;lt;m&amp;gt;      : &quot;Ω&quot;  U03A9
&amp;lt;Multi_key&amp;gt; &amp;lt;O&amp;gt; &amp;lt;underscore&amp;gt; : &quot;Ω&quot;  U03A9
&amp;lt;Multi_key&amp;gt; &amp;lt;underscore&amp;gt; &amp;lt;O&amp;gt; : &quot;Ω&quot;  U03A9

&amp;lt;Multi_key&amp;gt; &amp;lt;p&amp;gt; &amp;lt;h&amp;gt; &amp;lt;y&amp;gt; : &quot;φ&quot;  U03C6
&amp;lt;Multi_key&amp;gt; &amp;lt;o&amp;gt; &amp;lt;bar&amp;gt;   : &quot;φ&quot;  U03C6
&amp;lt;Multi_key&amp;gt; &amp;lt;bar&amp;gt; &amp;lt;o&amp;gt;   : &quot;φ&quot;  U03C6&lt;/pre&gt;
&lt;p&gt;This takes effect for each newly started applications. Feel free to leave a comment if you know how to add such a support on other&lt;br /&gt;
systems.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1745/&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/1745/&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=1745&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>Cédric</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 – Perl 6 from 30,000 feet</title>
		<link href="http://perl6advent.wordpress.com/2012/12/17/day-17-perl-6-from-30000-feet/"/>
		<id>http://perl6advent.wordpress.com/?p=1709</id>
		<updated>2012-12-17T00:00:25+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Many people have heard of Perl 6, especially in the greater Perl community.  However, Perl 6 has a complicated ecosystem which can be a littled daunting, so as a newcomer to the Perl 6 community myself, I thought I would share what I’ve learned.&lt;/p&gt;
&lt;h2&gt;How do I install Perl 6?&lt;/h2&gt;
&lt;p&gt;It’s simple; you can just download one of the existing implementations of the language (as Perl 6 is a specification), build it, and install it!  There are several implementations out there right now, in various states of completion. &lt;a href=&quot;http://www.rakudo.org/&quot;&gt;Rakudo&lt;/a&gt; is an implementation that targets Parrot, and is the implementation that I will discuss most in this post. Niecza is another implementation that targets the CLR (the .NET runtime). For more information on these implementations and on other implementations, please see &lt;a href=&quot;http://www.perl6.org/compilers/&quot;&gt;Perl 6 Compilers&lt;/a&gt;.  Perl 6 is an ever-evolving language, and any compiler that passes the official test suite can be considered a Perl 6 implementation.&lt;/p&gt;
&lt;h2&gt;You mentioned “Parrot”; what’s that?&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://www.parrot.org/&quot;&gt;Parrot&lt;/a&gt; is a virtual machine that is designed to run dynamically typed languages.  Along with the virtual machine, it includes tools for generating virtual machine code from intermediate languages (named PIR and PASM), as well as a suite of tools to make writing compilers easier.&lt;/p&gt;
&lt;h2&gt;What is Rakudo written in?&lt;/h2&gt;
&lt;p&gt;Rakudo itself is written primarly in Perl 6, with some bits of C for some of the lower-level operations, like binding method arguments and adding additional opcodes to the Parrot VM.  It may seem strange to implement a Perl 6 compiler in Perl 6 itself; Rakudo uses NQP for building itself.&lt;/p&gt;
&lt;h2&gt;What’s NQP?&lt;/h2&gt;
&lt;p&gt;NQP (or Not Quite Perl 6) is an implementation of Perl 6 that is focused on creating compilers for the Parrot Compiler Toolkit.  It is currently focused on targetting Parrot, but in the future, it may support various compilation targets, so you will be able to use Rakudo to compile your Perl 6 programs to Parrot opcodes, a JVM class file, or perhaps Javascript so you can run it in the browser.  NQP is written in NQP, and uses a pre-compiled version of NQP to compile itself.&lt;/p&gt;
&lt;p&gt;I hope that this information was useful to you, dear reader, and that it helps to clarify the different pieces of the Perl 6 ecosystem.  As I learn more about each piece, I intend to write blog posts that will hopefully help others to get started contributing to Perl 6!&lt;/p&gt;
&lt;p&gt;-Rob&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1709/&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/1709/&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=1709&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>hoelzro</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 16 – Operator precedence</title>
		<link href="http://perl6advent.wordpress.com/2012/12/16/day-16-operator-precedence/"/>
		<id>http://perl6advent.wordpress.com/?p=1728</id>
		<updated>2012-12-16T00:01:04+00:00</updated>
		<content type="html" xml:lang="en">&lt;h2&gt;All the precedence men&lt;/h2&gt;
&lt;p&gt;As I was taking a walk today, I realized one of the reasons why I like Perl. Five as well as six. I often hear praise such as “Perl fits the way I think”. And I have that feeling too sometimes.&lt;/p&gt;
&lt;p&gt;If I were the president (or prime minister, as I’m Swedish), and had a bunch of advisers, maybe some of them would be yes-men, trying to give me advice that they think I will want to hear, instead of advice that would be useful to me. Some languages are like that, presenting us with an incomplete subset of the necessary tools. The Perl languages, if they were advisers, wouldn’t be yes-men. They’d give me an accurate view of the world, even if that view would be a bit messy and hairy sometimes.&lt;/p&gt;
&lt;p&gt;Which, I guess, is why Perl five and six are so often used in handling messy data and turning it into something useful.&lt;/p&gt;
&lt;p&gt;To give a few specific examples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Perl 5 takes quotes and quoting &lt;em&gt;very&lt;/em&gt; seriously. Not just strings but lists of strings, too. (See the &lt;code&gt;qw&lt;/code&gt; keyword.) Perl 6 does the same, but takes quoting further. See &lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/10/day-10-dont-quote-me-on-it/&quot;&gt;see the recent post on quoting&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;jnthn shows in &lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/15/day-15-phasers-set-to-stun/&quot;&gt;yesterday’s advent post&lt;/a&gt; that Perl 6 takes compiler phases seriously, and allows us to bundle together code that belongs together conceptually but not temporally. We need to do this because the world is gnarly and running a program happens in phases.&lt;/li&gt;
&lt;li&gt;Grammars in Perl 6 are not just powerful, but in some sense honest, too. They don’t oversimplify the task for the programmer, because then they would also limit the expressibility. Even though grammars are complicated and intricate, they &lt;em&gt;should&lt;/em&gt; be, because they describe a process (parsing) that is complicated and intricate.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Operators&lt;/h2&gt;
&lt;p&gt;Perl is known for its many operators. Some would describe it as an “operator-oriented” language. Where many other language will try to guess how you want your operators to behave on your values, or perhaps demand that you pre-declare all your types so that there’ll be no doubt, Perl 6 carries much of the typing information in its operators:&lt;/p&gt;
&lt;pre&gt;my $a = 5;
my $b = 6;

say $a + $b;      # 11 (numeric addition)
say $a * $b;      # 30 (numeric multiplication)

say $a ~ $b;      # &quot;56&quot; (string concatenation)
say $a x $b;      # &quot;555555&quot; (string repetition)

say $a || $b;     # 5 (boolean disjunction)
say $a &amp;amp;&amp;amp; $b;     # 6 (boolean conjunction)
&lt;/pre&gt;
&lt;p&gt;Other languages will want to bunch together some of these for us, using the &lt;code&gt;+&lt;/code&gt; operator for both numeric addition and string concatenation, for example. Not so Perl. You’re meant to choose yourself, because the choice matters. In return, Perl will care a little less about the types of the operands, and just deliver the appropriate result for you.&lt;/p&gt;
&lt;p&gt;“The appropriate result” is most often a number if you used a numeric operator, and a string if you used a string operator. But sometimes it’s more subtle than that. Note that the boolean operators above actually preserved the numbers 5 and 6 for us, even though internally it treated them both as true values. In C, if we do the same, C will unhelpfully “flatten” these results down to the value 1, its spelling of the value &lt;code&gt;true&lt;/code&gt;. Perl knows that truthiness comes in many flavors, and retains the particular flavor for you.&lt;/p&gt;
&lt;h2&gt;Operator precedence&lt;/h2&gt;
&lt;p&gt;“All operators are equal, but some operators are more equal than others.” It is when we combine operators that we realize that the operators have different “tightness”.&lt;/p&gt;
&lt;pre&gt;say 2 * 3 + 1;      # 7, because (2 * 3) + 1
say 1 + 2 * 3;      # 7, because 1 + (2 * 3), not 9
&lt;/pre&gt;
&lt;p&gt;We can always be 100% explicit and surround enough of our operations with parentheses… but when we don’t, the operators seem to order themselves in some order, which is not just simple left-to-right evaluation. This ordering between operators is what we refer to as “precedence”.&lt;/p&gt;
&lt;p&gt;No doubt you were taught in math class in school that multiplications should be evaluated before additions in the way we see above. It’s as if factors group together closer than terms do. The fact that this difference in precedence is useful is backed up by centuries of algebra notation. Most programming languages, Perl 6 included, incorporates this into the language.&lt;/p&gt;
&lt;p&gt;By the way, this difference in precedence is found between other pairs of operators, even outside the realm of mathematics:&lt;/p&gt;
&lt;pre&gt;      Additive (loose)    Multiplicative (tight)
      ================    ======================
number      +                       *
string      ~                       x
bool        ||                      &amp;amp;&amp;amp;&lt;/pre&gt;
&lt;p&gt;It turns out that they make as much sense for other types as they do for numbers. And group theory bears this out: these other operators can be seen as a kind of addition and multiplication, if we squint.&lt;/p&gt;
&lt;h2&gt;Operator precedence parser&lt;/h2&gt;
&lt;p&gt;Deep in the bowels of the Perl 6 parser sits a smaller parser which is very good at parsing expressions. The bigger parser which parses your Perl 6 program is a really good &lt;em&gt;recursive-descent&lt;/em&gt; parser. It works great for creating syntax trees out of the larger program structure. It works less well on the level of expressions. Essentially, what trips up a recursive-descent parser is that it always has to create AST nodes for all the possible precedence levels, whether they’re present or not.&lt;/p&gt;
&lt;p&gt;So this smaller parser is an &lt;em&gt;operator-table&lt;/em&gt; parser. It knows what to do with each type of operator (prefix, infix, postfix…), and kind of weaves all the terms and operators into a syntax tree. Only the precedence levels actually used show up in the tree.&lt;/p&gt;
&lt;p&gt;The optable parser works by comparing each new operator to the top operator on a stack of operators. So when it sees an expression like this:&lt;/p&gt;
&lt;pre&gt;$x ** 2 + 3 * $x - 5&lt;/pre&gt;
&lt;p&gt;it will first compare &lt;code&gt;**&lt;/code&gt; against &lt;code&gt;+&lt;/code&gt; and decide that the former is tighter, and thus &lt;code&gt;$x ** 2&lt;/code&gt; should be put together into a small tree. Later, it compares &lt;code&gt;+&lt;/code&gt; against &lt;code&gt;*&lt;/code&gt;, and decides to turn &lt;code&gt;3 * $x&lt;/code&gt; into a small tree. It goes on like this, eventually ending up with this tree structure:&lt;/p&gt;
&lt;pre&gt;infix:&amp;lt;-&amp;gt;
 +-- infix:&amp;lt;+&amp;gt;
      +-- infix:&amp;lt;**&amp;gt;
      |    +-- term:&amp;lt;$x&amp;gt;
      |    +-- term:&amp;lt;2&amp;gt;
      +-- infix:&amp;lt;*&amp;gt;
           +-- term:&amp;lt;3&amp;gt;
           +-- term:&amp;lt;$x&amp;gt;&lt;/pre&gt;
&lt;p&gt;Because leaf nodes are evaluated first and the root node last, this tree structure determines the order of evaluation for the expression. The order ends up being the same as if the expression had these parentheses:&lt;/p&gt;
&lt;pre&gt;(($x ** 2) + (3 * $x)) - 5&lt;/pre&gt;
&lt;p&gt;Which, again, is what we’ve learned to expect.&lt;/p&gt;
&lt;h2&gt;Associativity&lt;/h2&gt;
&lt;p&gt;Another factor also governs how these invisible parentheses are to be distributed: operator &lt;em&gt;associativity&lt;/em&gt;. It’s the concern of how the operator combines with multiple copies of itself, or other sufficiently similar operators on the same precedence level.&lt;/p&gt;
&lt;p&gt;Some examples serve to explain the difference:&lt;/p&gt;
&lt;pre&gt;$x = $y = $z;     # becomes $x = ($y = $z)
$x / $y / $z;     # becomes ($x / $y) / $z&lt;/pre&gt;
&lt;p&gt;In both of these cases, we may look at the way the parentheses are doled out, and say “well, of course”. Of course we must first assign to &lt;code&gt;$y&lt;/code&gt; and only then to &lt;code&gt;$x&lt;/code&gt;. And of course we first divide by &lt;code&gt;$y&lt;/code&gt; and only then by &lt;code&gt;$z&lt;/code&gt;. So operators naturally have different associativity.&lt;/p&gt;
&lt;p&gt;The optable parser compares not just the precedence of two operators but also, when needed, their associativity. And it puts the parentheses in the right place, just as above.&lt;/p&gt;
&lt;h2&gt;User-defined operators&lt;/h2&gt;
&lt;p&gt;Now we come back to Perl not being a yes-man, and working hard to give you the appropriate tools for the job.&lt;/p&gt;
&lt;p&gt;Perl 6 allows you to define operators. See &lt;a href=&quot;http://perl6advent.wordpress.com/2011/12/22/day-22-operator-overloading-revisited/&quot;&gt;my post from last year&lt;/a&gt; on the details of how. But it also allows you to specify precedence and associativity of each new operator.&lt;/p&gt;
&lt;p&gt;As you specify a new operator, a new Perl 6 parser is automatically constructed for you behind the scenes, which contains your new operator. In this sense, the optable parser is open and extensible. And Perl 6 gives you exactly the same tools for talking about precedence and associativity as the compiler itself uses internally.&lt;/p&gt;
&lt;p&gt;Perl treats you like a grown-up, and expects you to make good decisions based on a thorough understanding of the problem space. I like that.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1728/&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/1728/&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=1728&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">Day 15 – Phasers set to stun</title>
		<link href="http://perl6advent.wordpress.com/2012/12/15/day-15-phasers-set-to-stun/"/>
		<id>http://perl6advent.wordpress.com/?p=1706</id>
		<updated>2012-12-15T13:28:07+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;When writing programs, it’s important not only to separate the concerns that need separating, but also to try and keep related things close to each other. This gives the program a sense of cohesion, and helps to avoid the inevitable problems that arise when updating one part of a program demands an update in another far-away part. One especially tricky problem can be when the things we want to do are distributed over time. This can cause us to move related things apart in order to get them to happen at the times we want.&lt;/p&gt;
&lt;p&gt;Phasers in Perl 6 help you keep related concepts together in your code, while also indicating that certain aspects of them should happen at different points during the lifetime of the current program, invocation or loop construct. Let’s take a look at some of them.&lt;/p&gt;
&lt;h3&gt;ENTER and LEAVE&lt;/h3&gt;
&lt;p&gt;One of the things I had most fun writing in Perl 6 recently was the debugger. There are various things that need a little care. For example, the debugger needs to look out for exceptions and, when they are thrown, give the user a prompt to let them debug why the exception was thrown. However, there is also a feature where, at the prompt, you can evaluate an expression. The debugger shouldn’t re-enter itself if this expression throws, so we need to keep track of if we’re already showing the prompt. This meant setting and clearing a flag. Thing is, the prompt method is relatively lengthy; it has a given/when to identify the various different commands. I could, of course, have set the prompt flag at the start and cleared it at the end. But that would have spread out the concern of maintaining the flag. Here’s what I did instead:&lt;/p&gt;
&lt;pre&gt;method issue_prompt($ctx, $cur_file) {
    ENTER $in_prompt = True;
    LEAVE $in_prompt = False;

    # Lots of stuff here
}&lt;/pre&gt;
&lt;p&gt;This ensures the flag is set when we enter the method, cleared when we leave the method – and lets me keep the two together.&lt;/p&gt;
&lt;h3&gt;INIT and END&lt;/h3&gt;
&lt;p&gt;We’re writing a small utility and want to log what happens as we run it. Time wise, we want to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the log file at the start of the program, creating it if needed and overwriting an existing one otherwise&lt;/li&gt;
&lt;li&gt;Write log entries at various points during the program’s execution&lt;/li&gt;
&lt;li&gt;Close the log file at the end&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Those three actions are fairly spread out in time, but we’d like to collect them together. This time, the INIT and END phasers come to the rescue.&lt;/p&gt;
&lt;pre&gt;sub log($msg) {
    my $fh = INIT open(&quot;logfile&quot;, :w);
    $fh.say($msg);
    END $fh.close;
}&lt;/pre&gt;
&lt;p&gt;Here, we use INIT to perform an action at program start time. It turns out that INIT also keeps around the value produced by the expression following it, meaning it can be used as an r-value. This means we have the file handle available to us, and can write to it during the program. Then, at the END of the program, we close the file handle. All of these have block forms, should you wish to do something more involved:&lt;/p&gt;
&lt;pre&gt;sub log($msg) {
    my $fh = INIT open(&quot;logfile&quot;, :w);
    $fh.say($msg);
    END {
        $fh.say(&quot;Ran in {now - INIT now} seconds&quot;);
        $fh.close;
    }
}&lt;/pre&gt;
&lt;p&gt;Note the second use of INIT in this example, to compute and remember the program start time so we can use it in the subtraction later on.&lt;/p&gt;
&lt;h3&gt;FIRST, NEXT and LAST&lt;/h3&gt;
&lt;p&gt;These phasers work with loops. They fire the first time the loop body executes, at the end of every loop body execution, and after the last loop body execution. FIRST and LAST are especially powerful in so far as they let us move code that wants to special-case the first and last time the loop body runs inside of the loop construct itself. This makes the relationship between these bits of code and the loop especially clear, and lessens the chance somebody moves or copies the loop and forgets the related bits it has.&lt;/p&gt;
&lt;p&gt;As an example, let’s imagine we are rendering a table of scores from a game. We want to write a header row, and also do a little ASCII art to denote the start and end of the table. Furthermore, we’d like to keep track of the best score each time around the loop, and then at the end print out the best score. Here’s how we could write it.&lt;/p&gt;
&lt;pre&gt;for %scores.kv -&amp;gt; $player, $score {
    FIRST say &quot;Score\tPlayer&quot;;
    FIRST say &quot;-----\t------&quot;;
    LAST  say &quot;-----\t------&quot;;

    NEXT (state $best_score) max= $score;
    LAST say &quot;BEST SCORE: $best_score&quot;;

    say &quot;$score\t$player&quot;;
}&lt;/pre&gt;
&lt;p&gt;Notice how we keep the header/footer code together, as well as being able to keep the best score tracking code together. It’s also all inside the loop, making its relationship to the loop clear. Note how the state variable also comes in useful here. It too is a construct that lets us keep a variable scoped inside a block even if its usage spans multiple invocations of the block.&lt;/p&gt;
&lt;h3&gt;KEEP and UNDO&lt;/h3&gt;
&lt;p&gt;These are variants of LEAVE that trigger conditional on the block being successful (KEEP) or not (UNDO). A successful block completes without unhandled exceptions and returns a defined value. An unsuccessful block exits due to an exception or because it returns an undefined value. Say we were processing a bunch of files and want to build up arrays of successful files and failed files. We could write something like:&lt;/p&gt;
&lt;pre&gt;sub process($file) {
    KEEP push @success, $file;
    UNDO push @failure, $file;

    my $fh = open($file);
    # ...
}&lt;/pre&gt;
&lt;p&gt;There are probably a bunch of transaction-like constructs that can also be very neatly implemented with these two.&lt;/p&gt;
&lt;h3&gt;And there’s more!&lt;/h3&gt;
&lt;p&gt;While I’ve covered a bunch of the phasers here, there are some others. For example, there’s also BEGIN, which lets you do some computation at compile time. Hopefully, though, this set of examples gives you some inspiration in how phasers can be used effectively, as well as a better grasp of the motivation for them. Bringing related things together and setting unrelated things apart is something we need to think carefully about every day as developers, and phasers help us keep related concerns together, even if they should take place at different phases of our program’s execution.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1706/&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/1706/&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=1706&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">Perl 6 changes - 2012W50</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2012W50.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2012W50.html</id>
		<updated>2012-12-15T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;So, this is yet another article in Perl 6 Changes series. (I know, those introductions are really boring, but would you like to see Lorem Ipsum Dolor instead)? As in previous week, Rakudo mainly improves Perl 6 parsing.&lt;/p&gt;&lt;p&gt;By the way, if you don’t know about &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2012-perl-6-coding-contest&quot; title=&quot;Strangely Consistent - The 2012 Perl 6 Coding Contest&quot;&gt;Perl 6 Coding Contest&lt;/a&gt;, check it out. The challenges are rather easy if you had any programming language experience (if you don’t know Perl 6, check out &lt;a href=&quot;https://github.com/perl6/book/downloads&quot; title=&quot;GitHub: perl6/book (Downloads&quot;&gt;Using Perl 6&lt;/a&gt; book). If you still have questions, people in &lt;a href=&quot;irc://chat.freenode.net/perl6&quot; title=&quot;Freenode: #perl6&quot;&gt;#perl6&lt;/a&gt; can help you.&lt;/p&gt; id='incompatible_changes'&amp;gt;Incompatible changes&amp;gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;uniq&lt;/code&gt; has &lt;code&gt;===&lt;/code&gt; semantics. It could break your programs if you for example were using &lt;code&gt;uniq&lt;/code&gt; to remove identical arrays (previously they were converted to strings which did what you wanted, as long the strings in array didn’t contained space or you didn’t have array in array.&lt;/li&gt;
&lt;/ul&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;“Two terms in a row” error message.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Information about what was expected, if possible.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ perl6 -e '2 2'
===SORRY!===
Two terms in a row
at -e:1
------&amp;gt; 2 ⏏2
    expecting any of:
        postfix
        infix or meta-infix
        infix stopper
        statement end
        statement modifier
        statement modifier loop&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;code&gt;for 1..10 { say so 9999 == any(1..2000) }&lt;/code&gt; is 30 times faster (huge junctions are faster).&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Added Texas versions of the Set and Bag operators, used in &lt;a href=&quot;https://perl6advent.wordpress.com/2012/12/13/day-13-bags-and-sets/&quot; title=&quot;Perl 6 Advent: Day 13 - Bags and Sets&quot;&gt;Bags and Sets&lt;/a&gt; article in Perl 6 Advent Calendar.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Rakudo Perl now informs about obsolete use of &lt;code&gt;.&lt;/code&gt; to concatenate strings.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;Implemented &lt;code&gt;sub term:&amp;lt;foo&amp;gt;&lt;/code&gt;. Now &lt;code&gt;2 + 2 == 5&lt;/code&gt; can be true for sufficiently huge values of 2 (not like it should be).&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;code&gt;qww&lt;/code&gt; now works.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;slurp&lt;/code&gt; now works without arguments.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html">The 2012 Perl 6 Coding Contest</title>
		<link href="http://strangelyconsistent.org/blog/the-2012-perl-6-coding-contest"/>
		<id>tag:strangelyconsistent.org,2012-12-14:blog/the-2012-perl-6-coding-contest</id>
		<updated>2012-12-14T20:21:30+00:00</updated>
		<content type="html">&lt;p&gt;For the third year in a row, let's write some Perl 6 contest code!&lt;/p&gt;

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

&lt;p&gt;Perl 6 has had a great year, with its two major implementations growing increasingly mature. Sometimes it's easy to forget all the progress that happens each month. Features and performance have improved all through the year. I think that will show in this year's entries.&lt;/p&gt;

&lt;p&gt;So here's what's happening:&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 proud to announce a &lt;em&gt;second&lt;/em&gt; prize as well: Amazon books worth 100 USD! (Redeemable within a year of winning.)&lt;/p&gt;

&lt;p&gt;The contest starts &lt;em&gt;now&lt;/em&gt;, today on 2012-12-14. It ends five weeks later, on 2013-01-18. 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 I'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;https://github.com/masak/p6cc2012/blob/master/rules.md&quot;&gt;&lt;code&gt;rules.md&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;Tell knights from knaves based on what they say. &lt;a href=&quot;http://github.com/masak/p6cc2012/blob/master/t1/description.md&quot;&gt;(more)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Generate rectangle haikus. &lt;a href=&quot;http://github.com/masak/p6cc2012/blob/master/t2/description.md&quot;&gt;(more)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Arrange wire crossings to rearrange wires. &lt;a href=&quot;http://github.com/masak/p6cc2012/blob/master/t3/description.md&quot;&gt;(more)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Simulate rain in a world of cubes. &lt;a href=&quot;http://github.com/masak/p6cc2012/blob/master/t4/description.md&quot;&gt;(more)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Distribute weights in bags evenly. &lt;a href=&quot;http://github.com/masak/p6cc2012/blob/master/t5/description.md&quot;&gt;(more)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'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;This time, the whole contest is running as a &lt;a href=&quot;http://github.com/masak/p6cc2012&quot;&gt;GitHub repository&lt;/a&gt;. Easier than hosting zip files.&lt;/p&gt;

&lt;p&gt;Now sign up — you've nothing to lose, and books to win! Also, this is your chance to finally take a look at Perl 6. 哈哈&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Looking for previous years' tasks and solutions? Here they are: &lt;a href=&quot;http://strangelyconsistent.org/blog/masaks-perl-6-coding-contest&quot;&gt;2010 tasks&lt;/a&gt; and &lt;a href=&quot;http://strangelyconsistent.org/p6cc2010/&quot;&gt;2010 solutions&lt;/a&gt;. &lt;a href=&quot;http://strangelyconsistent.org/blog/the-2011-perl-6-coding-contest&quot;&gt;2011 tasks&lt;/a&gt; and &lt;a href=&quot;http://strangelyconsistent.org/p6cc2011/&quot;&gt;2011 solutions&lt;/a&gt;.)&lt;/em&gt;&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 14 – Primal Needs</title>
		<link href="http://perl6advent.wordpress.com/2012/12/14/primal-needs/"/>
		<id>http://perl6advent.wordpress.com/?p=1677</id>
		<updated>2012-12-14T20:00:18+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Our brains are hard-wired to look for patterns, even where none exist.  So, it’s no surprise that as soon as mankind started counting things, he would look for patterns in numbers. One group of numbers that have resisted the pattern matching capabilities of the human brain are the so-called “prime numbers”. These are numbers that can only be evenly divided by 1 or themselves–they have no other factors.&lt;/p&gt;
&lt;p&gt;But you knew that already, so why am I talking about prime numbers instead of Perl 6? Because, just like our ancestors, the people that created Perl 6 and continue to shape it to be around for the next 100 years or more find prime numbers interesting. So interesting, in fact, that the language specification was modified to include a routine for determining whether or not a number is prime.&lt;/p&gt;
&lt;h2&gt;Alpha&lt;/h2&gt;
&lt;p&gt;At first, implmementations of this prime-number-finder were pure Perl 6 and took advantage of other features of the language such as ranges and junctions. An example implementation is shown below:&lt;/p&gt;
&lt;pre&gt;    sub is-prime($n) { $n %% none 2..sqrt $n }
&lt;/pre&gt;
&lt;p&gt;This implementation checks to see that none of numbers from 2 to the square root of &lt;code&gt;$n&lt;/code&gt; will evenly divide &lt;code&gt;$n&lt;/code&gt;. If this is the case, then the number is prime.&lt;/p&gt;
&lt;p&gt;While the above implementation works fine, it is a little slow and it does suffer a little redundancy in the numbers it checks. For instance, if you know a number isn’t evenly divisible by 2, there’s no need to check if it’s evenly divisible by 4, yet the above algorithm does so anyway.&lt;/p&gt;
&lt;h2&gt;Beta&lt;/h2&gt;
&lt;p&gt;An improvement on the algorithm is to only check if the I between 2 and the square root of the number evenly divide the number.  But … but … that’s like like defining a word in terms of itself.  Thanks to ubiquitous lazy evaluation in Perl 6, that’s entirely possible.  Here’s an implementation:&lt;/p&gt;
&lt;pre&gt;    my @primes := 2, 3, 5, -&amp;gt; $p { ($p+2, $p+4 ... &amp;amp;is-prime)[*-1] } ... *;
    sub is-prime($n) { $n %% none @primes ...^  * &amp;gt; sqrt $n }
&lt;/pre&gt;
&lt;p&gt;The array &lt;code&gt;@primes&lt;/code&gt; is an infinite, lazily evaluated sequence of numbers starting with 2, 3, and 5. The next number in the sequence is generated by creating a new sequence of odd numbers that start from the last odd number and continue until we reach a prime. That prime is the next number in the sequence. But how do we know if it’s a prime? We check with our handy C subroutine that actually uses the lazy list of primes up to the square root of the number we’re testing to see if any of them are factors.&lt;/p&gt;
&lt;p&gt;There’s a kind of mutual recursion going on here where the &lt;code&gt;@primes&lt;/code&gt; array effectively memoizes the primes we’ve seen so far. But … then there’s the problem that &lt;code&gt;@primes&lt;/code&gt; will continue to grow as you check bigger and bigger numbers for prime-ness.  Can we do better?  &lt;/p&gt;
&lt;p&gt;Indeed we can.&lt;/p&gt;
&lt;h2&gt;Gamma: Rabin-Miller test&lt;/h2&gt;
&lt;p&gt;Well … &lt;i&gt;maybe&lt;/i&gt; we can.  It depends on your idea of “better”.  The &lt;a href=&quot;http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test&quot;&gt;Rabin-Miller primality test&lt;/a&gt; is probabalistic in nature.  It doesn’t require storing an ever increasing cache of prime numbers to test if they are factors of the potential prime, but there is a chance that it will tell you that a number is prime when it actually isn’t.  The good news is that we can adjust the odds so that we are reasonably confident that the number is prime.  Here’s an implementation (taken from &lt;a href=&quot;http://rosettacode.org/wiki/Miller-Rabin_primality_test#Perl_6&quot;&gt;http://rosettacode.org/wiki/Miller-Rabin_primality_test#Perl_6&lt;/a&gt;):&lt;/p&gt;
&lt;pre&gt;sub expmod(Int $a is copy, Int $b is copy, $n) {
	my $c = 1;
	repeat while $b div= 2 {
		($c *= $a) %= $n if $b % 2;
		($a *= $a) %= $n;
	}
	$c;
}
 
subset PrimeCandidate of Int where { $_ &amp;gt; 2 and $_ % 2 };
 
my Bool multi sub is-prime(Int $n, Int $k)            { return False; }
my Bool multi sub is-prime(2, Int $k)                 { return True; }
my Bool multi sub is-prime(PrimeCandidate $n, Int $k) {
	my Int $d = $n - 1;
	my Int $s = 0;
 
	while $d %% 2 {(PrimeCandidate $n, Int $k)
		$d div= 2;
		$s++;
	}
 
	for (2 ..^ $n).pick($k) -&amp;gt; $a {
		my $x = expmod($a, $d, $n);
 
		next if $x == 1 or $x == $n - 1;
 
		for 1 ..^ $s {
			$x = $x ** 2 mod $n;
			return False if $x == 1;
			last if $x == $n - 1;
		}
		return False if $x !== $n - 1;
	}
 
	return True;
}
&lt;/pre&gt;
&lt;p&gt;The third multi variant of &lt;code&gt;is-prime&lt;/code&gt; with the signature &lt;code&gt;(PrimeCandidate $n, Int $k)&lt;/code&gt; is where all of the magic happens.  This multi is only triggered when the prime candidate (&lt;code&gt;$n&lt;/code&gt;) is an odd number because of the definition of the &lt;code&gt;PrimeCandidate&lt;/code&gt; type.&lt;/p&gt;
&lt;p&gt;
First, we factor out the powers of 2 from &lt;code&gt;$n - 1&lt;/code&gt;.  Since &lt;code&gt;$n&lt;/code&gt; is an odd number, &lt;code&gt;$n - 1&lt;/code&gt; is even and so has at least one factor of 2. What we end up with is an odd number and some power-of-2 factors of &lt;code&gt;$n - 1&lt;/code&gt;.  We then use those factors to see if a random sample of &lt;code&gt;$k&lt;/code&gt; numbers less than &lt;code&gt;$n&lt;/code&gt; are congruent to the square roots of unity modulo &lt;code&gt;$n&lt;/code&gt; (&lt;code&gt;expmod&lt;/code&gt; handles the modular exponentiation).  We repeat this for all of the powers of 2 we factored out of the original number.  &lt;a href=&quot;http://en.wikipedia.org/wiki/Fermat's_little_theorem&quot;&gt;Fermat’s little theorem&lt;/a&gt; says that if we find any number where the congruence does &lt;b&gt;not&lt;/b&gt; hold, then the number can not be prime.&lt;/p&gt;
&lt;p&gt;The probability that this method will select a composite number as prime is based on how many numbers less than &lt;code&gt;$n&lt;/code&gt; we choose to sample.  If we select &lt;code&gt;$k&lt;/code&gt; numbers to try, the probability is &lt;code&gt;4 ** -$k&lt;/code&gt;. By choosing to sample more numbers, we can quickly decrease the odds of a false positive to a negligible amount.&lt;/p&gt;
&lt;h2&gt;Wrap up&lt;/h2&gt;
&lt;p&gt;But … most people don’t really have to worry about the implementation details of &lt;code&gt;is-prime&lt;/code&gt;.   Not only have &lt;code&gt;is-prime&lt;/code&gt; and &lt;code&gt;expmod&lt;/code&gt; been added to the Perl 6 specification, but actual implementations (ala Rabin-Miller) have been added to the Rakudo and Niecza Perl 6 compilers. So, if you want to test your new cryptographic algorithm and need some large prime numbers, or if you’re developing a new random number generator and need some candidates for the modulus, or maybe you’re developing a new hashing algorithm, Perl 6 has a built-in &lt;code&gt;is-prime&lt;/code&gt; that can help.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1677/&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/1677/&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=1677&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">Day 13 – Bags and Sets</title>
		<link href="http://perl6advent.wordpress.com/2012/12/13/day-13-bags-and-sets/"/>
		<id>http://perl6advent.wordpress.com/?p=1646</id>
		<updated>2012-12-13T15:50:59+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Over the years, I’ve written many variations on this code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;my %words;
for slurp.comb(/\w+/).map(*.lc) -&amp;gt; $word {
    %words{$word}++;
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;(Aside: &lt;code&gt;slurp.comb(/\w+/).map(*.lc)&lt;/code&gt; does the standard Perl trick of reading files specified on the command line or standard in, goes through the data for words, and makes them lowercase.)&lt;/p&gt;
&lt;p&gt;Perl 6 introduces two new Associative types for dealing with this sort of functionality. &lt;code&gt;KeyBag&lt;/code&gt; is drop-in replacement for &lt;code&gt;Hash&lt;/code&gt; in this sort of case:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;my %words := KeyBag.new;
for slurp.comb(/\w+/).map(*.lc) -&amp;gt; $word {
    %words{$word}++;
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Why would you prefer &lt;code&gt;KeyBag&lt;/code&gt; over &lt;code&gt;Hash&lt;/code&gt; in this case, considering that it’s a bit more code? Well, it does a better job of saying what you mean, if what you want is a positive &lt;code&gt;Int&lt;/code&gt;-valued &lt;code&gt;Hash&lt;/code&gt;. It actually enforces this as well:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;&amp;gt; %words{&quot;the&quot;} = &quot;green&quot;;
Unhandled exception: Cannot parse number: green
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That’s Niecza’s error; Rakudo’s is less clear, but the important point is you get an error; Perl 6 detects that you’ve violated your contract and complains.&lt;/p&gt;
&lt;p&gt;And &lt;code&gt;KeyBag&lt;/code&gt; has a couple more tricks up its sleeve. First, four lines to initialize your &lt;code&gt;KeyBag&lt;/code&gt; isn’t terribly verbose, but Perl 6 has no trouble getting it down to one line:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;my %words := KeyBag.new(slurp.comb(/\w+/).map(*.lc));
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;KeyBag.new&lt;/code&gt; does its best to turn whatever it is given into the contents of a &lt;code&gt;KeyBag&lt;/code&gt;. Given a &lt;code&gt;List&lt;/code&gt;, each of the elements is added to the &lt;code&gt;KeyBag&lt;/code&gt;, with the exact same result of our earlier block of code.&lt;/p&gt;
&lt;p&gt;If you don’t need to modify the bag after its creation, then you can use &lt;code&gt;Bag&lt;/code&gt; instead of &lt;code&gt;KeyBag&lt;/code&gt;. The difference is &lt;code&gt;Bag&lt;/code&gt; is immutable; if &lt;code&gt;%words&lt;/code&gt; is a &lt;code&gt;Bag&lt;/code&gt;, then &lt;code&gt;%words{$word}++&lt;/code&gt; is illegal. If immutability is okay for your application, then you can make the code even more compact:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;my %words := bag slurp.comb(/\w+/).map(*.lc);
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;bag&lt;/code&gt; is a helper sub that just calls &lt;code&gt;Bag.new&lt;/code&gt; on whatever you give it. (I’m not sure why there is no equivalent &lt;code&gt;keybag&lt;/code&gt; sub.)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Bag&lt;/code&gt; and &lt;code&gt;KeyBag&lt;/code&gt; have a couple more tricks up their sleeve. They have their own versions of &lt;code&gt;.roll&lt;/code&gt; and &lt;code&gt;.pick&lt;/code&gt; which weigh their results according to the given values:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;&amp;gt; my $bag = bag &quot;red&quot; =&amp;gt; 2, &quot;blue&quot; =&amp;gt; 10;
&amp;gt; say $bag.roll(10);
&amp;gt; say $bag.pick(*).join(&quot; &quot;);
blue blue blue blue blue blue red blue red blue
blue red blue blue red blue blue blue blue blue blue blue
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This wouldn’t be too hard to emulate using a normal &lt;code&gt;Array&lt;/code&gt;, but this version would be:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;&amp;gt; $bag = bag &quot;red&quot; =&amp;gt; 20000000000000000001, &quot;blue&quot; =&amp;gt; 100000000000000000000;
&amp;gt; say $bag.roll(10);
&amp;gt; say $bag.pick(10).join(&quot; &quot;);
blue blue blue blue red blue red blue blue blue
blue blue blue red blue blue blue red blue blue
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;They also work with all the standard &lt;code&gt;Set&lt;/code&gt; operators, and have a few of their own as well. Here’s a simple demonstration:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;sub MAIN($file1, $file2) {
    my $words1 = bag slurp($file1).comb(/\w+/).map(*.lc);
    my $words2 = set slurp($file2).comb(/\w+/).map(*.lc);
    my $unique = ($words1 (-) $words2);
    for $unique.list.sort({ -$words1{$_} })[^10] -&amp;gt; $word {
        say &quot;$word: { $words1{$word} }&quot;;
    }
}
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Passed two filenames, this makes a &lt;code&gt;Bag&lt;/code&gt; from the words in the first file, a &lt;code&gt;Set&lt;/code&gt; from the words in the second file, uses the set difference operator &lt;code&gt;(-)&lt;/code&gt; to compute the set of words which are only in the first file, sorts those words by their frequency of appearance, and then prints out the top ten.&lt;/p&gt;
&lt;p&gt;This is the perfect point to introduce &lt;code&gt;Set&lt;/code&gt;. As you might guess from the above, it works much like &lt;code&gt;Bag&lt;/code&gt;. Where &lt;code&gt;Bag&lt;/code&gt; is a &lt;code&gt;Hash&lt;/code&gt; from &lt;code&gt;Any&lt;/code&gt; to positive &lt;code&gt;Int&lt;/code&gt;, &lt;code&gt;Set&lt;/code&gt; is a &lt;code&gt;Hash&lt;/code&gt; from &lt;code&gt;Any&lt;/code&gt; to &lt;code&gt;Bool::True&lt;/code&gt;. &lt;code&gt;Set&lt;/code&gt; is immutable, and there is also a mutable &lt;code&gt;KeySet&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Between &lt;code&gt;Set&lt;/code&gt; and &lt;code&gt;Bag&lt;/code&gt; we have a very rich collection of operators:&lt;/p&gt;
&lt;table align=&quot;center&quot; border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; summary=&quot;Set &amp;amp; Bag operators&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;Operation&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Unicode&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;“Texas”&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Result Type&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;is an element of&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;∈&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(elem)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;is not an element of&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;∉&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;!(elem)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;contains&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;∋&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(cont)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;does not contain&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;∌&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;!(cont)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;union&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;∪&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(|)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Set or Bag&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;intersection&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;∩&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(&amp;amp;)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Set or Bag&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;set difference&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(-)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Set&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;set symmetric difference&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(^)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Set&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;subset&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊆&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(&amp;lt;=)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;not a subset&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊈&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;!(&amp;lt;=)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;proper subset&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊂&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(&amp;lt;)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;not a proper subset&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊄&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;!(&amp;lt;)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;superset&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊇&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(&amp;gt;=)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;not a superset&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊉&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;!(&amp;gt;=)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;proper superset&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊃&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(&amp;gt;)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;not a proper superset&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊅&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;!(&amp;gt;)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;bag multiplication&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊍&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(.)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bag&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;bag addition&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;⊎&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;(+)&lt;/td&gt;
&lt;td align=&quot;center&quot;&gt;Bag&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Most of these are self-explanatory. Operators that return &lt;code&gt;Set&lt;/code&gt; promote their arguments to &lt;code&gt;Set&lt;/code&gt; before doing the operation. Operators that return &lt;code&gt;Bag&lt;/code&gt; promote their arguments to &lt;code&gt;Bag&lt;/code&gt; before doing the operation. Operators that return &lt;code&gt;Set&lt;/code&gt; or Bag promote their arguments to &lt;code&gt;Bag&lt;/code&gt; if at least one of them is a &lt;code&gt;Bag&lt;/code&gt; or &lt;code&gt;KeyBag&lt;/code&gt;, and to &lt;code&gt;Set&lt;/code&gt; otherwise; in either case they return the type promoted to.&lt;/p&gt;
&lt;p&gt;Please note that while the set operators have been in Niecza for some time, they were only added to Rakudo yesterday, and only in the Texas variations.&lt;/p&gt;
&lt;p&gt;A bit of a word may be needed for the different varieties of unions and intersections of &lt;code&gt;Bag&lt;/code&gt;. The normal union operator takes the max of the quantities in either bag. The intersection operator takes the min of the quantities in either bag. Bag addition adds the quantities from either bag. Bag multiplication multiplies the quantities from either bag. (There is some question if the last operation is actually useful for anything — if you know of a use for it, please let us know!)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;&amp;gt; my $a = bag &amp;lt;a a a b b c&amp;gt;;
&amp;gt; my $b = bag &amp;lt;a b b b&amp;gt;;

&amp;gt; $a (|) $b;
bag(&quot;a&quot; =&amp;gt; 3, &quot;b&quot; =&amp;gt; 3, &quot;c&quot; =&amp;gt; 1)

&amp;gt; $a (&amp;amp;) $b;
bag(&quot;a&quot; =&amp;gt; 1, &quot;b&quot; =&amp;gt; 2)

&amp;gt; $a (+) $b;
bag(&quot;a&quot; =&amp;gt; 4, &quot;b&quot; =&amp;gt; 5, &quot;c&quot; =&amp;gt; 1)

&amp;gt; $a (.) $b;
bag(&quot;a&quot; =&amp;gt; 3, &quot;b&quot; =&amp;gt; 6)
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I’ve placed my full set of examples for this article and several data files to play with on &lt;a href=&quot;https://github.com/colomon/perl6-set-bag-demo&quot;&gt;Github&lt;/a&gt;. All the sample files should work on the latest very latest Rakudo from Github; I think all but &lt;code&gt;most-common-unique.pl&lt;/code&gt; and &lt;code&gt;bag-union-demo.pl&lt;/code&gt; should work with the latest proper Rakudo releases. Meanwhile those two scripts will work on Niecza, and with any luck I’ll have the bug stopping the rest of the scripts from working there fixed in the next few hours.&lt;/p&gt;
&lt;p&gt;A quick example of getting the 10 most common words in Hamlet which are not found in Much Ado About Nothing:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;brush: plain; light: true;&quot;&gt;&amp;gt; perl6 bin/most-common-unique.pl data/Hamlet.txt data/Much_Ado_About_Nothing.txt
ham: 358
queen: 119
hamlet: 118
hor: 111
pol: 86
laer: 62
oph: 58
ros: 53
horatio: 48
clown: 47
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1646/&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/1646/&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=1646&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">Day 12 – Exceptions</title>
		<link href="http://perl6advent.wordpress.com/2012/12/12/exceptions/"/>
		<id>http://perl6advent.wordpress.com/?p=1605</id>
		<updated>2012-12-12T05:12:35+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Sometimes things go horribly wrong, and the only thing you can do is not to go on. Then you throw an exception.&lt;/p&gt;
&lt;p&gt;But of course the story doesn’t end there. The caller (or the caller’s caller) must somehow deal with the exception. To do that in a sensible manner, the caller needs to have as much information as possible.&lt;/p&gt;
&lt;p&gt;In Perl 6, exceptions should inherit from the type &lt;code&gt;Exception&lt;/code&gt;, and by convention they go into the &lt;code&gt;X::&lt;/code&gt; namespace.&lt;/p&gt;
&lt;p&gt;So for example if you write a HTTP client library, and you decide that an exception should be thrown when the server returns a status code starting with 4 or 5, you could declare your exception class as&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; class X::HTTP is Exception {
     has $.request-method;
     has $.url;
     has $.status;
     has $.error-string;

     method message() {
         &quot;Error during $.request-method request&quot;
         ~ &quot; to $.url: $.status $.error-string&quot;;
     }
 }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And throw an exception as&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; die X::HTTP.new(
     request-method  =&amp;gt; 'GET',
     url             =&amp;gt; 'http://example.com/no-such-file',
     status          =&amp;gt; 404,
     error-string    =&amp;gt; 'Not found',
 );&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The error message then looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Error during GET request to
    http://example.com/no-such-file: 404 Not found&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(line wrapped for the benefit of small browser windows).&lt;/p&gt;
&lt;p&gt;If the exception is not caught, the program aborts and prints the error message, as well as a backtrace.&lt;/p&gt;
&lt;p&gt;There are two ways to catch exceptions. The simple Pokemon style “gotta catch ‘em all” method catches exception of any type with &lt;code&gt;try&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; my $result = try do-operation-that-might-die();
 if ($!) {
     note &quot;There was an error: $!&quot;;
     note &quot;But I'm going to go on anyway&quot;;
 }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or you can selectively catch some exception types and handle only them, and rethrow all other exceptions to the caller:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; my $result =  do-operation-that-might-die();
 CATCH {
     when X::HTTP {
         note &quot;Got an HTTP error for URL $_.url()&quot;;
         # do some proper error handling
     }
     # exceptions not of type X::HTTP are rethrown
 }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that the CATCH block is inside the same scope as the one where the error might occur, so that by default you have access to all the interesting varibles from that scope, which makes it easy to generate better error messages.&lt;/p&gt;
&lt;p&gt;Inside the CATCH block, the exception is available as &lt;code&gt;$_&lt;/code&gt;, and is matched against all &lt;code&gt;when&lt;/code&gt; blocks.&lt;/p&gt;
&lt;p&gt;Even if you don’t need to selectively catch your exceptions, it still makes sense to declare specific classes, because that makes it very easy to write tests that checks for proper error reporting. You can check the type and the payload of the exceptions, without having to resort to checking the exact error message (which is always brittle).&lt;/p&gt;
&lt;p&gt;But Perl 6 being Perl, it doesn’t force you to write your own exception types. If you pass a non-&lt;code&gt;Exception&lt;/code&gt; objects to &lt;code&gt;die()&lt;/code&gt;, it simply wraps them in an object of type &lt;code&gt;X::AdHoc&lt;/code&gt; (which in turn inherits from &lt;code&gt;Exception&lt;/code&gt;), and makes the argument available with the &lt;code&gt;payload&lt;/code&gt; method:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    sub I-am-fatal() {
        die &quot;Neat error message&quot;;
    }
    try I-am-fatal();
    say $!;             # Neat error message;
    say $!.perl;        # X::AdHoc.new(payload =&amp;gt; &quot;Neat error message&quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To find out more about exception handling, you can read &lt;a href=&quot;http://doc.perl6.org/type/Exception&quot;&gt;the documentation of class Exception&lt;/a&gt; and &lt;a href=&quot;http://doc.perl6.org/type/Backtrace&quot;&gt;Backtrace&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1605/&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/1605/&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=1605&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 11 – Parrot threads</title>
		<link href="http://perl6advent.wordpress.com/2012/12/11/day-11-parrot-threads/"/>
		<id>http://perl6advent.wordpress.com/?p=1624</id>
		<updated>2012-12-11T00:08:03+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;&lt;em&gt;Editors note: I, rurban, does know almost nothing about threads. Any errors are probably mine. I just tested them, fixed some deadlocks, added the numcpu code and merged the threads branch to master.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Parrot now supports fast and lightweight OS threads, based on Nat Tucks’s initial GSoC work together with Andrew “whiteknight” Whitworth on green threads and finally Stefan Seifert’s extension to true parallel OS threads as hybrid threads.&lt;br /&gt;
See &lt;a href=&quot;http://wknight8111.blogspot.co.at/2010/08/gsoc-threads-chandons-results.html&quot;&gt;http://wknight8111.blogspot.co.at/2010/08/gsoc-threads-chandons-results.html&lt;/a&gt; and &lt;a href=&quot;http://niner.name/Hybrid_Threads_for_the_Parrot_VM.pdf&quot;&gt;http://niner.name/Hybrid_Threads_for_the_Parrot_VM.pdf&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;History&lt;/h3&gt;
&lt;p&gt;Parrot always supported &lt;em&gt;“threads”&lt;/em&gt;, i.e. concurrency models over the last years, but we identified various problems with the particular designs and were continuously improving them. In our case without changing the API too much, as the &lt;a href=&quot;http://docs.parrot.org/parrot/latest/html/docs/pdds/pdd25_concurrency.pod.html&quot;&gt;pdd25 concurrency spec&lt;/a&gt; is pretty high level, describing the various models parrot should support, and also pretty low-level in describing the two PMC’s which export the threads API, the &lt;strong&gt;Task&lt;/strong&gt; and the &lt;strong&gt;Scheduler&lt;/strong&gt; classes.&lt;/p&gt;
&lt;p&gt;Being born at a time when Perl 6 still looked much more similar to Perl 5 than it does nowadays, Parrot’s threading support initially was very close to Perl’s ithreads model. Previous attempts to change this into the more conventional model of data shared by default or implementing new technologies like STM “Software Transactional Memory” failed. For example Parrot has never supported running multiple threads and having garbage collection at the same time.&lt;/p&gt;
&lt;p&gt;In the year 2005 development of faster Central Processing Units (CPUs) shifted from increased speed of a single core to adding more cores. Modern processors contain up to 12 cores with even mobile phones having up to four. To utilize a modern CPU’s power, code needs to be run in parallel. In UNIX (and thus Perl) tradition, this is accomplished using multiple processes being a good solution for many use cases. For many others like auto threading of hyper operators in Perl 6, the cost of process setup and communication would be prohibitively high except for very large data sets.&lt;/p&gt;
&lt;p&gt;During the years of back and forth and failed attempts of adding threading support to Parrot, the Perl 6 specification evolved to a point where the largest parts of the language were covered and its features were implemented in the compilers. The lack of concurrency primitives in Parrot however prevents any progress in the area of concurrency support.&lt;/p&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;Green threads were used to simplify the implementation of a nearly lock free multithreading implementation. &lt;a href=&quot;http://niner.name/Hybrid_Threads_for_the_Parrot_VM.pdf&quot;&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Parrot supports now native Win32 threads and POSIX threads. Win32 alarm, sleep and premption is unified with POSIX, it is handled on a common timer thread.&lt;/p&gt;
&lt;p&gt;Parrot creates at startup a thread pool of &lt;code&gt;--numthreads&lt;/code&gt; threads, which defaults to the number of available CPU cores. Activating a new thread at runtime causes no run-time penalties, until the number of cores is utilized. When a user starts a new task, the scheduler first looks for an idle thread. If one can be found, the task is scheduled on the thread’s interpreter. If more tasks are started than the maximum number of threads, the tasks are distributed evenly among the running interpreters. This is effectively an implementation of the N:M threading model.&lt;/p&gt;
&lt;h2&gt;Green threads&lt;/h2&gt;
&lt;p&gt;Our GSOC student Nan “Chandor” Tuck worked in summer 2010 on green threads.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;What I have working now is a pre-emptively scheduled green threads system for Parrot that allows programs to be written in a concurrent style. Individual green threads can do basic blocking file input without stopping other threads from running. These logical threads are accessed using the Task API that I described a couple weeks ago.&lt;/em&gt; &lt;em&gt;This functionality makes Parrot similarly powerful at threading as the standard version of Ruby or Python: Threads can do pretty much everything except run at the same time.&lt;/em&gt; &lt;a href=&quot;http://parrot.org/content/hybrid-threads-gsoc-project-results&quot;&gt;http://parrot.org/content/hybrid-threads-gsoc-project-results&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What was missing from this green threads branch was true parallel execution in OS threads, one global_interpreter structure that is shared and protected by locks or other concurrent access rules and many local_interpreters that run simultaneously in separate OS threads.&lt;/p&gt;
&lt;h2&gt;OS threads&lt;/h2&gt;
&lt;p&gt;From Fall 2011 to Summer 2012 Stefan “nine” Seifert implemented true OS threads on top of green threads to finally allow true parallel execution of Tasks, to implement blocking IO, and to give perl6 some more advantages over perl5.&lt;/p&gt;
&lt;p&gt;The lightweight “green” threads are used as messages in a system where reading shared variables is allowed but only the one owner thread may write to it. That’s why we call it hybrid threads.&lt;/p&gt;
&lt;h2&gt;Why is multithreading support so difficult to implement?&lt;/h2&gt;
&lt;p&gt;Low level programming languages like C provide only the bare necessities, leaving the responsibility for preventing data corruption and synchronization entirely to the user. A high-level language like Perl 6 on the other hand provides complex and compound data types, handles garbage collection and a very dynamic object system. Even seemingly simple things like a method call can become very complex. In a statically typed programming language the definition of a class is immutable. Thus, calling a method on an object contains just the steps of determining the object’s class, fetching the required method from this class and calling it. Calling the same method again can then even omit the first two steps since their results cannot change.&lt;/p&gt;
&lt;p&gt;In a dynamic language, the object may change its class at runtime. The inheritance hierarchy of the class may be changed by adding or removing parent classes. Methods may be added to or removed from classes (or objects) at runtime and even the way how to find a method of a class may change. So a simple method call results in the following steps:&lt;/p&gt;
&lt;pre&gt;    ·  determining the class of the object,
    ·  determining the method resolution method of the class,
    ·  finding the actual method to call,
    ·  calling the method.&lt;/pre&gt;
&lt;p&gt;These steps have to be repeated for every method call, because the results may change any time. In a threaded environment, a thread running in parallel may change the underlying data and meta data in between those sequences and even between those steps. As a consequence, this meta data has to be protected from corruption introducing the need for locks in a performance critical area.&lt;/p&gt;
&lt;p&gt;Many interpreters for dynamic languages like Python or Ruby handle this problem by using a global interpreter lock (GIL) to effectively serialize all operations. This is a proven and reliable way but leaves much of the hardware’s potential unused.&lt;/p&gt;
&lt;h2&gt;Java&lt;/h2&gt;
&lt;p&gt;In Java, the user is responsible for preventing concurrency issues. The language provides synchronization primitives like mutexes, but the interpreter (the Java Virtual Machine, JVM) does not protect the consistency of the provided data structures. The class library provides the user with high-level data structures explicitly designed for multithreaded scenarios.&lt;/p&gt;
&lt;p&gt;Java version 1.1 used green threads to support multithreaded execution of Java programs. Green threads are threads simulated by the virtual machine (VM) but unable to use more than one CPU core for processing. Version 1.2 introduced native Operating System (OS) threading support which since has become the standard way to do multithreading in Java.&lt;/p&gt;
&lt;h2&gt;Python&lt;/h2&gt;
&lt;p&gt;The CPython implementation of the Python runtime uses a Global Interpreter Lock (GIL) to protect its internal consistency. This is a single lock taken whenever the interpreter executes Python bytecode. Because of this lock, only one thread can execute bytecode at any time so all built-in types and the object model are implicitly type safe. The drawback is that Python code cannot benefit from having multiple CPU cores available. However I/O operations and calls to external libraries are executed without holding the GIL, so in applications with multiple I/O bounded threads, there may still be a performance benefit from using multithreading.&lt;/p&gt;
&lt;p&gt;To run Python code in parallel, multiple processes have to be used. The multiprocessing module provides support for spawning processes exposed through an API similar to the threading module. Since processes may not directly access other processes’ memory, the multiprocessing module provides several means of communication between processes: Queues, Pipes and shared memory support.&lt;/p&gt;
&lt;h2&gt;Parrot&lt;/h2&gt;
&lt;p&gt;Much of Parrot’s previous threading related code has been removed to clean up the code and improve performance. Since the existing threading support was known to be unreliable and seriously flawed, this was no trade off. The final parts were removed by the merging of the &lt;code&gt;kill_threads&lt;/code&gt; branch on September, 21st 2011.&lt;/p&gt;
&lt;p&gt;In 2010, Nat Tuck began working on a &lt;code&gt;green_threads&lt;/code&gt; branch during his Google Summer of Code internship. The feature got prototyped using pure PIR and then implemented in Parrot’s core. He got it to work in simple cases and started to work on OS thread support but the internship ended before the code was ready to be merged into the master branch. The code lay dormant until the work on hybrid threads in the &lt;code&gt;threads&lt;/code&gt; branch started in 2011.&lt;/p&gt;
&lt;p&gt;In Parrot, green threads are called Tasks. Each task is assigned a fixed amount of execution time. After this time is up a timer callback sets a flag which is checked at execution of every branch operation. Since the interpreter’s state is well defined at this point, its internal consistency is guaranteed. The same holds for the GC. Since task preemption is only done while executing user-level code, the GC can do its work undisturbed and without the need for measures like locking. Since user-level code is allowed to disable the scheduler, it can be guaranteed to run undisturbed through critical sections.&lt;/p&gt;
&lt;p&gt;The scheduler is implemented as a PMC type. This allows the user to subclass this PMC thus allowing fine-grained control over the scheduling policy. Features, a user could add this way would be for example giving different priorities to tasks or implementing the possibility to suspend and resume a task.&lt;/p&gt;
&lt;h2&gt;Shared data&lt;/h2&gt;
&lt;p&gt;Cross-thread writes to shared variables may endanger the internal consistency of the interpreter. Traditionally, the solution to this problem is the use of locks of varying granularity. Fine-grained locking allows code to run in parallel but taking and releasing locks costs performance. It not only increases the instruction count and memory accesses but it also forces the CPU cores to coordinate and thus communicate. Even a seemingly simple operation like an atomic increment can take two orders of magnitude longer than a normal increment. While the gain through being able to utilize multiple CPU cores may offset this cost, it is still impacting the common case of having only a single thread running.&lt;/p&gt;
&lt;p&gt;Too coarse locking on the other hand would reduce scalability and the performance gains through parallel execution by having threads wait for extended periods for locks to become available. In the extreme case of having a global interpreter lock it would effectively serialize all computations costing much of the benefits of using threads in the first place.&lt;/p&gt;
&lt;p&gt;The other problem with locking is the possibility of introducing deadlocks. For example, two functions F1 and F2 both use two resources A and B protected by locks. If F1 first locks A and then tries to lock B while F2 has already locked B and is now trying to lock A, the program would come to a halt. Both functions would be left waiting for the other to unlock the resource which will never happen. With fine-grained locking, the possibilities for such bugs grow quickly. At the same time, it is easy to miss a case where a lock would be appropriate leading to difficult to diagnose corruption bugs.&lt;/p&gt;
&lt;p&gt;The solution for these problems implemented in hybrid threads is to sidestep them altogether by disallowing write access to shared variables. The programmer (or in most cases the compiler) is obliged to declare a list of all shared variables before a newly created task is started. The interpreter would then create proxy objects for these variables which the task can use to access the data. These proxies contain references to the original objects. They use these references to forward all reading vtable functions to the originals. Write access on the other hand would lead to a runtime error.&lt;/p&gt;
&lt;p&gt;In other words, all data is owned by the thread creating it and only the owner may write to it. Other threads have only read access.&lt;/p&gt;
&lt;p&gt;For threads to be able to communicate with their creators and other threads, they still need to write to shared variables. This is where green threads come into play. Since green threads are light weight, it is feasible for a thread to create a task just for updating a variable. This task is scheduled on the interpreter owning this variable. To reduce latency, the task is flagged to run immediately. The data-owning interpreter will preempt the currently running task and process the new write task. Put another way, the data-owning interpreter is told what to write to its variables, so other threads don’t have to.&lt;/p&gt;
&lt;h2&gt;Proxies&lt;/h2&gt;
&lt;p&gt;Proxies are the arbiters between threads. They are the only means for a thread to access another thread’s data and are implemented by the Proxy PMC type.&lt;/p&gt;
&lt;p&gt;Proxy has default implementations for all functions, writing functions raise a &lt;code&gt;cant_do_write_method&lt;/code&gt; runtime exception.  If a method returns a PMC from the target’s interp, another proxy object has to be created and wrapped around it so it can be safely returned to the caller.&lt;/p&gt;
&lt;h2&gt;Sub&lt;/h2&gt;
&lt;p&gt;The Sub PMC represents executable subroutines. A Sub does not only contain the code to execute but also the context in which to execute the code such as visible globals and namespaces.  If a proxy to such a Sub were created and invoke called on it, the code would access this context directly since it belongs to the same interp as the proxied Sub itself.  Thus, an operation like &lt;code&gt;get_global&lt;/code&gt; fetches a global from an unproxied namespace and an unproxied global is be put into the target register.  Since this is happening while running invoke on the original Sub, Proxy cannot intercept the call and create a Proxy for the result.&lt;/p&gt;
&lt;p&gt;This is the reason why &lt;code&gt;Parrot_thread_create_proxy&lt;/code&gt; does not create a Proxy for a Sub but uses &lt;tt&gt;Parrot_thread_create_local_sub&lt;/tt&gt; to create a copy on the thread’s interp with proxies for all PMC attributes.&lt;/p&gt;
&lt;h2&gt;Writing to shared variables&lt;/h2&gt;
&lt;p&gt;To write to shared variables, a thread creates a task and schedules it on the data owning interpreter. An example task looks like this:&lt;/p&gt;
&lt;pre&gt;    .sub write_to_variable
         .param pmc variable
         variable = 1
    .end
&lt;/pre&gt;
&lt;p&gt;This is a subroutine with just one parameter. The variable passed as this parameter is the one the task should write to. In this case the constant value 1 would be written to the variable. In PIR, an assignment to a PMC gets translated to a method call. In this case, the &lt;code&gt;set_integer_native&lt;/code&gt; is called changing the variable’s value. Since PMCs are passed by reference, it is the original variable which gets written to.&lt;/p&gt;
&lt;p&gt;Code to create the task looks like:&lt;/p&gt;
&lt;pre&gt;    1    write_task = new ['Task']
    2    setattribute write_task, 'code', write_to_variable
    3    setattribute write_task, 'data', shared_variable
    4    interp.'schedule_proxied'(write_task, shared_variable)&lt;/pre&gt;
&lt;p&gt;Line 1 creates a new task object. The example subroutine is used for the task’s code attribute. &lt;code&gt;shared_variable&lt;/code&gt; is used for data. At this point, &lt;code&gt;shared_variable&lt;/code&gt; is actually the proxy object created for the shared integer PMC. The interpreter object contains a &lt;code&gt;schedule_proxied&lt;/code&gt; method which is used to schedule the &lt;code&gt;write_task&lt;/code&gt; on the thread owning the original variable.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;schedule_proxied&lt;/code&gt; uses &lt;tt&gt;Parrot_thread_create_local_task&lt;/tt&gt; which in this case detects that the data given as parameter for the task’s code is actually a proxy already and unwraps the proxied object. &lt;code&gt;Parrot_cx_schedule_immediate&lt;/code&gt; is then used to make the data owning interpreter execute the task as soon as possible.&lt;/p&gt;
&lt;p&gt;To protect a critical section, preemption can be disabled so the critical section runs uninterrupted:&lt;/p&gt;
&lt;pre&gt;    1 .sub swap_variables
    2     .param pmc a, b
    3     .local temp
    4     disable_preemption
    5     temp = a
    6     a = b
    7     b = temp
    8     enable_preemption
    9 .end&lt;/pre&gt;
&lt;h3&gt;wait&lt;/h3&gt;
&lt;p&gt;Using tasks to write to shared variables makes such actions inherently asynchronous. This is not always what is needed by the implemented algorithm. For example, when the shared variable is a lock, processing should continue as soon as it’s acquired. The &lt;code&gt;wait&lt;/code&gt; operation is used to wait for a task’s completion. The waiting task is added to the waited for task’s waiters list and preempted immediately. When a task finishes, all the tasks in the waiters list are scheduled again for execution. Since for each task a local copy is created on the target thread, the running task not only checks its own waiters list but also its partner’s.&lt;/p&gt;
&lt;p&gt;If a task on the main thread was waiting for a task on another thread to finish and no other tasks are in the scheduler’s queue on the main thread, the main thread exits if no alarms are pending. To prevent this unintended exit, all tasks are added to the scheduler’s &lt;code&gt;foreign_tasks&lt;/code&gt; list when they are scheduled on other threads. To end the program with other threads still running, an explicit exit operation has to be used.&lt;/p&gt;
&lt;h2&gt;Benchmarks&lt;/h2&gt;
&lt;p&gt;Preliminary benchmarks have shown Parrot’s performance to be within an order of magnitude of that of an optimized implementation in Perl 5.&lt;/p&gt;
&lt;p&gt;Since Parrot does not yet offer the user any synchronization primitives, locks had to be implemented using a shared variable which is written to only by the main thread. Replacing this primitive method with a native semaphore implementation would probably reduce runtime to a small fraction.&lt;/p&gt;
&lt;h3&gt;Runtime comparison for matrix multiplication&lt;/h3&gt;
&lt;pre&gt;                singlethreaded  computation      multithreaded   computation
    1. run          28.522 s       19.530 s        17.543 s          8.478 s
    2. run          28.427 s       19.463 s        17.320 s          8.283 s
    3. run          28.200 s       19.235 s        17.489 s          8.473 s
    average         28.383 s       19.409 s        17.451 s          8.411 s&lt;/pre&gt;
&lt;p&gt;This test implements matrix multiplication using four threads. For simplicity the second matrix only has one column. The program is written in the Winxed programming language. Winxed is a low-level language with Javascript like syntax and the possibility to include sections of PIR code verbatim making it possible to try experimental opcodes while writing more readable and concise code than with PIR alone. The complete source code is available in &lt;a href=&quot;https://github.com/parrot/parrot/blob/master/examples/threads/matrix_part.winxed&quot;&gt;examples/threads/matrix_part.winxed&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The program consists of the parts initialization, computation and verification. Computation is parallelized using four tasks each calculating one fourth of the result vector. Runtime is compared to a simple singlethreaded implementation. Run times were measured using the time command and are recorded in the above table.&lt;/p&gt;
&lt;p&gt;As can be seen, the multithreaded implementation gives an average speedup of 2.31 for the computation and 1.61 in total.&lt;/p&gt;
&lt;h3&gt;Runtime comparison for Mandelbrot set calculation&lt;/h3&gt;
&lt;pre&gt;                 singlethreaded  1 thread    2 threads   4 threads    8 threads
    1. run           89.931 s    89.978 s    45.813 s     24.028 s     17.445 s
    2. run           89.707 s    89.871 s    45.906 s     24.048 s     17.695 s
    3. run           90.318 s    89.839 s    45.951 s     24.049 s     17.573 s
    average          89.985 s    89.896 s    45.890 s     24.042 s     17.571 s
    speedup           1.000        1.001       1.959       3.739        5.116&lt;/pre&gt;
&lt;p&gt;The complete source code is available in &lt;a href=&quot;https://github.com/parrot/parrot/blob/master/examples/pir/mandel.pir&quot;&gt;examples/pir/mandel.pir&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Calculating an image of the Mandelbrot set is a common benchmark for multithreading implementations since calculations of points are independent of each other and are thus easily parallelizable. A simple implementation of the escape time algorithm written in Winxed has been used to determine scalability properties of the threading implementation. The image is split into lines which are calculated alternatedly by a configured number of tasks. Run times were measured using the time command on an Intel Core i7 3770K processor with 16 GiB RAM running openSUSE 12.1 and are recorded in the Mandelbrot table. As can be seen, the implementation scales nearly linearly up to four threads reflecting the CPU’s four physical cores. Using eight threads, the speedup is only 1.368 compared to four threads but this seems to be more a limitation of the hardware than the implementation.&lt;/p&gt;
&lt;h2&gt;Questions&lt;/h2&gt;
&lt;p&gt;On IRC and on the mailing list some detailed questions have been asked.&lt;/p&gt;
&lt;p&gt;See here:&lt;br /&gt;
&lt;a href=&quot;http://lists.parrot.org/pipermail/parrot-dev/2012-December/007295.html&quot;&gt;http://lists.parrot.org/pipermail/parrot-dev/2012-December/007295.html&lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1624/&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/1624/&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=1624&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>rurban</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 – Longest Token Matching</title>
		<link href="http://perl6advent.wordpress.com/2012/12/09/day-9-longest-token-matching/"/>
		<id>http://perl6advent.wordpress.com/?p=1609</id>
		<updated>2012-12-09T00:01:19+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Perl 6 regular expressions prefer to match the longest alternative when possible.&lt;/p&gt;
&lt;pre&gt;say &quot;food and drink&quot; ~~ / foo | food /;   # food&lt;/pre&gt;
&lt;p&gt;This is in contrast to Perl 5, which would prefer the first alternative above, and produce the match “foo”.&lt;/p&gt;
&lt;p&gt;You can still get the first-alternative behavior if you want; it’s tucked away in the slightly longer alternation operator &lt;code&gt;||&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;say &quot;food and drink&quot; ~~ / foo || food /;  # foo&lt;/pre&gt;
&lt;p&gt;…And that’s it! That’s Longest Token Matching. ☺ Short post.&lt;/p&gt;
&lt;p&gt;“Huh, wait!” I hear you exclaim, in a desperate attempt to make the daily Perl 6 Advent goodness last a bit longer. “Why is Longest Token Matching such a big deal? Who would ever be so obsessed with long tokens?”&lt;/p&gt;
&lt;p&gt;I’m glad you asked. As it turns out, Longest Token Matching (or LTM for short) plays very well with our intuition about how things should be parsed. If you’re creating a language, you want people to be able to declare a variable &lt;code&gt;forest_density&lt;/code&gt; without the mention of this variable clashing with the syntax of &lt;code&gt;for&lt;/code&gt; loops. LTM will see to that.&lt;/p&gt;
&lt;p&gt;I like “strange consistencies” — when distal parts of a language design turn out to have commonalities that make the language feel more uniform. There is that kind of consistency here, between classes and grammars. Perl 6 basically exploits that consistency to the max. Let me briefly map out what I mean.&lt;/p&gt;
&lt;p&gt;We’re all used to writing classes at this point. From a birds-eye view, they look like this:&lt;/p&gt;
&lt;pre&gt;class {
    method
    method
    method
}&lt;/pre&gt;
&lt;p&gt;Grammars have a suspiciously similar structure:&lt;/p&gt;
&lt;pre&gt;grammar {
    rule
    rule
    rule
}&lt;/pre&gt;
&lt;p&gt;(The keywords are actually &lt;code&gt;regex&lt;/code&gt;, &lt;code&gt;token&lt;/code&gt; and &lt;code&gt;rule&lt;/code&gt;, but when we talk about them as a group, we just call them “rules”.)&lt;/p&gt;
&lt;p&gt;We’re also used to being able to derive classes into subclasses (&lt;code&gt;class B is A&lt;/code&gt;), and add or override methods in a way which produces a nice mix of old and new behavior. Perl 6 provides &lt;em&gt;multi methods&lt;/em&gt; which even allow you to add new methods of the same name, and the old ones won’t be overridden, they’ll just all try to match alongside the new methods. The dispatch is handled by a (usually autogenerated) &lt;em&gt;proto method&lt;/em&gt; that dispatches to all eligible candidates.&lt;/p&gt;
&lt;p&gt;What does all this have to do with grammars and rules? Well, it turns out that first off, you can derive new grammars from old ones. It works the same as deriving classes. (In fact, under the hood it’s &lt;em&gt;exactly&lt;/em&gt; the same mechanism. Grammars are classes with a different metaclass object.) New rules will override old rules just like you’d expect with methods.&lt;/p&gt;
&lt;p&gt;S05 has a cute example with parsing of letters, and deriving the grammar to parse formal letters:&lt;/p&gt;
&lt;pre&gt;     grammar Letter {
         rule text     {    }
         rule greet { [Hi|Hey|Yo] $=(\S+?) , $$}
         rule body     { +? }   # note: backtracks forwards via +?
         rule close { Later dude, $=(.+) }
     }

     grammar FormalLetter is Letter {
         rule greet { Dear $=(\S+?) , $$}
         rule close { Yours sincerely, $=(.+) }
     }&lt;/pre&gt;
&lt;p&gt;The derived &lt;code&gt;FormalLetter&lt;/code&gt; overrides &lt;code&gt;greet&lt;/code&gt; and &lt;code&gt;close&lt;/code&gt;, but not &lt;code&gt;body&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;But what about all the goodness with multi methods? Could we define some kind of “proto rule” that would allow us to have several rules in a grammar with the same name but different bodies? For example, we might want to parse a language with a rule &lt;code&gt;term&lt;/code&gt;, but there are many different terms: strings, numbers… and maybe the numbers can be decimal or binary or octal or hexadecimal…&lt;/p&gt;
&lt;p&gt;Perl 6 grammars can contain a proto rule, and then you can define and redefine a rule with the same name as many times as you want. And now we’re back full circle with the &lt;code&gt;/ foo | food /&lt;/code&gt; alternation from the start of the article. All those rules you write with the same name compile down to one big alternation. Not only that — rules which call other rules, some of them possibly proto rules, all of that will be “flattened” out into one big LTM alternation. In practice that means that all the possible things a term can be are tried out all at once, on equal footing. Neither alternative wins because you happened to define it before the others. An alternative wins because it is the longest.&lt;/p&gt;
&lt;p&gt;The strange consistency resides in the fact that in the call-a-method side of things, the most specific method wins, and “most specific” has to with signature narrowness. The better the types in the signature describe the arguments coming in, the more specific the method.&lt;/p&gt;
&lt;p&gt;In the parse-with-a-rule side of things, the most specific rule wins, but here “most specific” has to do with parse success. The better the rule can describe what comes next in the text, the more specific the rule.&lt;/p&gt;
&lt;p&gt;And that’s strangely consistent, because on the surface methods and rules look like quite different beasts.&lt;/p&gt;
&lt;p&gt;We really believe we have something going with this whole principle of deriving a grammar and getting a new language. LTM is right at the center of that because it allows new rules and old to intermix in a fair and predictable way. It’s a kind of meritocracy: rules win not based on whether they’re young or old, but based on whether they are able to parse the text well.&lt;/p&gt;
&lt;p&gt;In fact, the Perl 6 compiler itself works this way. It parses your program using a Perl 6 grammar, and that grammar is derivable… whenever you declare a new operator in your program, a new grammar is derived for you. The parsing of your operator is added as a new rule in the new grammar, and the new grammar is given the task of parsing the rest of your program. Your new operator will win against similar but shorter ones, and lose against similar but longer ones.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1609/&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/1609/&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=1609&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">Day 8 – Panda package manager</title>
		<link href="http://perl6advent.wordpress.com/2012/12/08/day-8-panda-package-manager/"/>
		<id>http://perl6advent.wordpress.com/?p=1596</id>
		<updated>2012-12-08T12:49:03+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Perl 6 is not just the language. While without modules it can do more than Perl 5, modules can make life easier. About two years ago &lt;a href=&quot;http://perl6advent.wordpress.com/2010/12/09/day-9-–-the-module-ecosystem/&quot;&gt;neutro was discussed on this blog&lt;/a&gt;. I’m not going to talk about it, as it’s deprecated today.&lt;/p&gt;
&lt;p&gt;Today, the standard way of installing modules is the panda utility. If you’re using Rakudo Star, you should have it already installed (try the panda command in console to check it). After running it and waiting a few seconds, you should see help for the panda utility.&lt;/p&gt;
&lt;pre style=&quot;overflow: auto;&quot;&gt;$ panda
Usage:
  panda [--notests] [--nodeps] install [ ...] -- Install the specified modules
  panda [--installed] [--verbose] list -- List all available modules
  panda update -- Update the module database
  panda info [ ...] -- Display information about specified modules
  panda search  -- Search the name/description&lt;/pre&gt;
&lt;p&gt;As you can see, it doesn’t have many options (it’s actually similar to RubyGems or cpanminus in its simplicity). You can see the current list of modules at Perl 6 Modules page. Let’s say you would want to parse an INI file. First, you can find module for it using the search command.&lt;/p&gt;
&lt;pre style=&quot;overflow: auto;&quot;&gt;$ panda search INI
JSON::Tiny               *          A minimal JSON (de)serializer
Config::INI              *          .ini file parser and writer module for
                                    Perl 6
MiniDBI                  *          a subset of Perl 5 DBI ported to Perl 6
                                    to use while experts build the Real Deal
Class::Utils             0.1.0      Small utilities to help with defining
                                    classes&lt;/pre&gt;
&lt;p&gt;Config::INI is module you want. Other modules were found because my query wasn’t specific enough and found “ini” in other words (m&lt;strong&gt;ini&lt;/strong&gt;mal, M&lt;strong&gt;ini&lt;/strong&gt;DBI and def&lt;strong&gt;ini&lt;/strong&gt;ng). Config::INI isn’t part of Rakudo Star, so you have to install it.&lt;/p&gt;
&lt;p&gt;Panda installs modules globally when you writing access to the installation directory, locally otherwise. Because of that you can use panda even when Perl 6 is installed globally without installing modules like local::lib, like you have to in Perl 5.&lt;/p&gt;
&lt;pre style=&quot;overflow: auto;&quot;&gt;$ panda install Config::INI
==&amp;gt; Fetching Config::INI
==&amp;gt; Building Config::INI
Compiling lib/Config/INI.pm
Compiling lib/Config/INI/Writer.pm
==&amp;gt; Testing Config::INI
t/00-load.t .... ok
t/01-parser.t .. ok
t/02-writer.t .. ok
All tests successful.
Files=3, Tests=55, 3 wallclock secs ( 0.04 usr 0.00 sys + 2.38 cusr 0.14 csys = 2.56 CPU)
Result: PASS
==&amp;gt; Installing Config::INI
==&amp;gt; Succesfully installed Config::INI&lt;/pre&gt;
&lt;p&gt;After the module has been installed, you can update it as easily – by installing it. Currently panda cannot automatically upgrade modules, but after a module has been updated (you can watch repositories on GitHub to know when it happens – every module is available on GitHub), you can easily upgrade it by reinstalling the module.&lt;/p&gt;
&lt;p&gt;When a module was installed, you can check if it works by trying to use it. This is a sample script that can be used to convert INI file into a Perl 6 data structure.&lt;/p&gt;
&lt;pre style=&quot;overflow: auto;&quot;&gt;&lt;code&gt;#!/usr/bin/env perl6
use Config::INI;
multi sub MAIN($file) {
    say '# your INI file as seen by Perl 6';
    say Config::INI::parse_file($file).perl;
}&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1596/&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/1596/&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=1596&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>GlitchMr</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">Perl 6 changes - 2012W49</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2012W49.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2012W49.html</id>
		<updated>2012-12-08T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;To begin with, I’ve made &lt;a href=&quot;https://perl6advent.wordpress.com/2012/12/08/day-8-panda-package-manager/&quot; title=&quot;Perl 6 Advent Calendar: Day 8 - Panda package manager&quot;&gt;a post for Perl 6 Advent Calendar&lt;/a&gt;. If you were wondering why it was late, I will tell you - it’s actually early. Somebody else has claimed article for eighth day and forgot to upload it, so somebody had to put replacement article. I’ve moved my article from 12th day to 8th day, just so Perl 6 Advent Calendar could be continued. Moritz, to protect against that, put the just-in-case article about exceptions (it’s exceptional), if that would happen again.&lt;/p&gt;&lt;p&gt;Enough talking about Perl 6 Advent Calendar, as obviously this blog post isn’t about it. Every week, I describe changes in Perl 6 and its implementations. This is yet another article about changes.&lt;/p&gt;&lt;p&gt;Jonathan Worthington lately was working on improving syntax errors messages in Rakudo Perl. Now they are better and more accurate, just like they’re already in STD.pm6 or Niecza.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;Syntax errors now provide context using ⏏ symbol, just like STD.pm6 does.&lt;/li&gt;

&lt;li&gt;Rakudo is now more accurate about error locations and doesn’t inform about errors on line 1 (like missing semicolon) that actually are on line 777.&lt;/li&gt;

&lt;li&gt;Syntax errors now have colors.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;.join&lt;/code&gt; method isn’t O(N&lt;sup&gt;4&lt;/sup&gt;) anymore.&lt;/li&gt;

&lt;li&gt;A &lt;code&gt;~&lt;/code&gt; infix operator is faster.&lt;/li&gt;

&lt;li&gt;Numeric ranges are faster.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 7 – MIME::Base64 – On encoded strings</title>
		<link href="http://perl6advent.wordpress.com/2012/12/07/day-7-mimebase64-on-encoded-strings/"/>
		<id>http://perl6advent.wordpress.com/?p=1217</id>
		<updated>2012-12-07T06:26:11+00:00</updated>
		<content type="html" xml:lang="en">&lt;h2&gt;parrot MIME::Base64 FixedIntegerArray: index out of bounds!&lt;/h2&gt;
&lt;p&gt;Ronaldxs created the following parrot &lt;a href=&quot;https://github.com/parrot/parrot/issues/813&quot;&gt;ticket #813&lt;/a&gt; 4 months ago:&lt;/p&gt;
&lt;p&gt;&lt;i&gt;“Was playing with p6 MIME::Base64 and utf8 sampler page when I came across this. It seems that the parrot MIME Base64 library can’t handle some UTF-8 characters as demonstrated below.”&lt;/i&gt;&lt;/p&gt;
&lt;pre&gt;.sub go :main
    load_bytecode 'MIME/Base64.pbc'

    .local pmc enc_sub
    enc_sub = get_global [ &quot;MIME&quot;; &quot;Base64&quot; ], 'encode_base64'

    .local string result_encode
    result_encode = enc_sub(utf8:&quot;\x{203e}&quot;)

    say result_encode
.end&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;FixedIntegerArray: index out of bounds!&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;current instr.: 'parrot;MIME;Base64;encode_base64'&lt;br /&gt;
pc 163 (runtime/parrot/library/MIME/Base64.pir:147)&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;called from Sub 'go' pc 11 (die_utf8_base64.pir:8)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This was interesting, because parrot strings store the encoding information in the string. The user does not need to store the string encoding information somewhere else as in perl5, nor have to do educated guesses about the encoding. parrot supports ascii, latin1, binary, utf-8, ucs-2, utf-16 and ucs-4 string encodings natively.&lt;br /&gt;
So we thought we the hell cannot parrot handle simple utf-8 encoded strings?&lt;/p&gt;
&lt;p&gt;As it turned out, the parrot implementation of MIME::Base64, which can be shared to all languages which use parrot as VM, stored the character codepoints for each character as array of integers. On multibyte encodings such as UTF-8 this leads to different data held in memory than a normal multibyte string which is encoded as the byte buffer and the additional encoding information.&lt;/p&gt;
&lt;h2&gt;Internal string representations&lt;/h2&gt;
&lt;p&gt;For example an overview of different internal string representations for the utf-8 string &lt;b&gt;“\x{203e}”&lt;/b&gt;:&lt;/p&gt;
&lt;p&gt;perl5 strings:&lt;/p&gt;
&lt;pre&gt;len=3, utf-8 flag, &quot;\342\200\276&quot; buf=[e2 80 be]&lt;/pre&gt;
&lt;p&gt;parrot strings:&lt;/p&gt;
&lt;pre&gt;len=1, bufused=3, encoding=utf-8, buf=[e2 80 be]&lt;/pre&gt;
&lt;p&gt;The Unicode tables:&lt;/p&gt;
&lt;pre&gt;U+203E	‾	e2 80 be	OVERLINE&lt;/pre&gt;
&lt;h2&gt;gdb perl5&lt;/h2&gt;
&lt;p&gt;Let’s check it out:&lt;/p&gt;
&lt;pre&gt;$ gdb --args perl -e'print &quot;\x{203e}&quot;'
(gdb) start
(gdb) b Perl_pp_print
(gdb) c
(gdb) n 

&lt;i&gt;.. until if (!do_print(*MARK, fp))&lt;/i&gt;

(gdb) p **MARK
$1 = {sv_any = 0x404280, sv_refcnt = 1, sv_flags = 671106052, sv_u = {
      svu_pv = &lt;b&gt;0x426dd0 &quot;‾&quot;&lt;/b&gt;, svu_iv = 4353488, svu_uv = 4353488, 
      svu_rv = 0x426dd0, svu_array = 0x426dd0, svu_hash = 0x426dd0, 
      svu_gp = 0x426dd0, svu_fp = 0x426dd0}, ...}

(gdb) p Perl_sv_dump(*MARK)
ALLOCATED at -e:1 for stringify (parent 0x0); serial 301
SV = PV(0x404280) at 0x4239a8
  REFCNT = 1
  FLAGS = (POK,READONLY,pPOK,&lt;strong&gt;UTF8&lt;/strong&gt;)
  PV = 0x426dd0 &quot;\342\200\276&quot; [UTF8 &quot;\x{203e}&quot;]
  CUR = &lt;strong&gt;3&lt;/strong&gt;
  LEN = 16
$2 = void

(gdb) x/3x 0x426dd0
0x426dd0:	&lt;strong&gt;0xe2	0x80	0xbe&lt;/strong&gt;&lt;/pre&gt;
&lt;p&gt;We see that perl5 does store the utf-8 flag, but not the length of the string, the utf8 length (=1), only the length of the buffer (=3).&lt;br /&gt;
Any other multi-byte encoded string, such as UCS-2 is stored differently. We suppose as utf-8.&lt;/p&gt;
&lt;p&gt;We are already in the debugger, so let’s try the different cmdline argument.&lt;/p&gt;
&lt;pre&gt;(gdb) run -e'use Encode; print encode(&quot;UCS-2&quot;, &quot;\x{203e}&quot;)'
  The program being debugged has been started already.
  Start it from the beginning? (y or n) y
Breakpoint 2, Perl_pp_print () at pp_hot.c:712
712	    dVAR; dSP; dMARK; dORIGMARK;

(gdb) p **MARK

$3 = {sv_any = 0x404b30, sv_refcnt = 1, sv_flags = 541700, sv_u = {
    svu_pv = &lt;strong&gt;0x563a50 &quot; &amp;gt;&quot;&lt;/strong&gt;, svu_iv = 5651024, svu_uv = 5651024, 
    svu_rv = 0x563a50, svu_array = 0x563a50, svu_hash = 0x563a50, svu_gp = 0x563a50, 
    svu_fp = 0x563a50}, ...}

(gdb) p Perl_sv_dump(*MARK)
ALLOCATED at -e:1 by return (parent 0x0); serial 9579
SV = PV(0x404b30) at 0x556fb8
  REFCNT = 1
  FLAGS = (TEMP,POK,pPOK)
  PV = 0x563a50 &quot; &amp;gt;&quot;
  CUR = 2
  LEN = 16
$4 = void

(gdb) x/2x 0x563a50
0x563a50:	&lt;strong&gt;0x20	0x3e&lt;/strong&gt;&lt;/pre&gt;
&lt;p&gt;But we don’t see the UTF8 flag in encode(“UCS-2″, “\x{203e}”), just the simple ascii string ” &amp;gt;”, which is the UCS-2 representation of [20 3e].&lt;br /&gt;
Because ” &amp;gt;” is perfectly representable as non-utf8 ASCII string.&lt;br /&gt;
UCS-2 is much much nicer than UTF-8, is has a fixed size, it is readable, Windows uses it, but it cannot represent all Unicode characters.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perldoc.perl.org/Encode/Unicode.html&quot; title=&quot;Encode::Unicode&quot;&gt;Encode::Unicode&lt;/a&gt; contains this nice cheatsheet:&lt;/p&gt;
&lt;pre&gt;&lt;b&gt;Quick Reference&lt;/b&gt;
                Decodes from ord(N)           Encodes chr(N) to...
       octet/char BOM S.P d800-dfff  ord &amp;gt; 0xffff     \x{1abcd} ==
  ---------------+-----------------+------------------------------
  UCS-2BE       2   N   N  is bogus                  Not Available
  UCS-2LE       2   N   N     bogus                  Not Available
  UTF-16      2/4   Y   Y  is   S.P           S.P            BE/LE
  UTF-16BE    2/4   N   Y       S.P           S.P    0xd82a,0xdfcd
  UTF-16LE    2/4   N   Y       S.P           S.P    0x2ad8,0xcddf
  UTF-32        4   Y   -  is bogus         As is            BE/LE
  UTF-32BE      4   N   -     bogus         As is       0x0001abcd
  UTF-32LE      4   N   -     bogus         As is       0xcdab0100
  UTF-8       1-4   -   -     bogus   &amp;gt;= 4 octets   \xf0\x9a\af\8d
  ---------------+-----------------+------------------------------&lt;/pre&gt;
&lt;h2&gt;gdb parrot&lt;/h2&gt;
&lt;p&gt;Back to parrot:&lt;/p&gt;
&lt;p&gt;If you debug parrot with gdb you get a gdb pretty-printer thanks to Nolan Lum, which displays the string and encoding information automatically.&lt;br /&gt;
In perl5 you have to call &lt;code&gt;Perl_sv_dump&lt;/code&gt; with or without the &lt;code&gt;my_perl&lt;/code&gt; as first argument, if threaded or not. With a threaded perl, e.g. on Windows you’d need to call &lt;code&gt;p Perl_sv_dump(my_perl, *MARK)&lt;/code&gt;.&lt;br /&gt;
In parrot you just ask for the value and the formatting is done with a gdb pretty-printer plugin.&lt;br /&gt;
The string length is called &lt;code&gt;strlen&lt;/code&gt; (of the encoded string), the buffer size is called &lt;code&gt;bufused&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Even in a backtrace the string arguments are displayed abbrevated like this:&lt;/p&gt;
&lt;pre&gt;#3  0x00007ffff7c29fc4 in utf8_iter_get_and_advance (interp=0x412050, str=&quot;utf8:� [1/2]&quot;, 
    i=0x7fffffffdd00) at src/string/encoding/utf8.c:551
#4  0x00007ffff7a440f6 in Parrot_str_escape_truncate (interp=0x412050, src=&quot;utf8:� [1/2]&quot;,
    limit=20) at src/string/api.c:2492
#5  0x00007ffff7b02fb3 in trace_op_dump (interp=0x412050, code_start=0x63a1c0, pc=0x63b688)
    at src/runcore/trace.c:450&lt;/pre&gt;
&lt;p&gt;[1/2] means strlen=1 bufused=2&lt;br /&gt;
Each non-ascii or non latin-1 encoded string is printed with the encoding prefix.&lt;br /&gt;
Internally the encoding is of course a index or pointer in the table of supported encodings.&lt;/p&gt;
&lt;p&gt;You can set a breakpoint to &lt;code&gt;utf8_iter_get_and_advance&lt;/code&gt; and watch the strings.&lt;/p&gt;
&lt;pre&gt;(gdb) r t/library/mime_base64u.t
Breakpoint 1, utf8_iter_get_and_advance (interp=0x412050, str=&quot;utf8:\\x{00c7} [8/8]&quot;, 
                i=0x7fffffffcd40) at src/string/encoding/utf8.c:544
(gdb) p str
$1 = &quot;utf8:\\x{00c7} [8/8]&quot;
(gdb) p str-&amp;gt;bufused 
$3 = 8
(gdb) p str-&amp;gt;strlen
$4 = 8
(gdb) p str-&amp;gt;strstart
$5 = 0x5102d7 &quot;\\x{00c7}&quot;&lt;/pre&gt;
&lt;p&gt;This is escaped. Let’s advance to a more interesting utf8 string in this test, i.e. until str=”utf8:Ā [1/2]“&lt;br /&gt;
You get the members of a struct with tab-completion, i.e. press &lt;strong&gt;&amp;lt;TAB&amp;gt;&lt;/strong&gt; after &lt;strong&gt;p str-&amp;gt;&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;(gdb) p str-&amp;gt;
&lt;strong&gt;_buflen    _bufstart  bufused    encoding   flags      hashval    strlen     strstart&lt;/strong&gt;
(gdb) p str-&amp;gt;strlen
$9 = 8

(gdb) dis 1
(gdb) b utf8_iter_get_and_advance if str-&amp;gt;strlen == 1
(gdb) c
Breakpoint 2, utf8_iter_get_and_advance (interp=0x412050, str=&quot;utf8:Ā [1/2]&quot;, 
                i=0x7fffffffcd10) at src/string/encoding/utf8.c:544
544	    ASSERT_ARGS(utf8_iter_get_and_advance)

(gdb) p str-&amp;gt;strlen
$10 = 1
(gdb) p str-&amp;gt;strstart
$11 = 0x7ffff7faeb58 &quot;Ā&quot;
(gdb) x/2x str-&amp;gt;strstart
0x7ffff7faeb58:	&lt;strong&gt;0xc4	0x80&lt;/strong&gt;
(gdb) p str-&amp;gt;encoding
$12 = (const struct _str_vtable *) 0x7ffff7d882e0
(gdb) p *str-&amp;gt;encoding

$13 = {num = 3, name = 0x7ffff7ce333f &quot;utf8&quot;, name_str = &quot;utf8&quot;, bytes_per_unit = 1,
  max_bytes_per_codepoint = 4, to_encoding = 0x7ffff7c292b0 &amp;lt;utf8_to_encoding&amp;gt;, chr =
  0x7ffff7c275c0 &amp;lt;unicode_chr&amp;gt;, equal = 0x7ffff7c252e0 &amp;lt;encoding_equal&amp;gt;, compare =
  0x7ffff7c254e0 &amp;lt;encoding_compare&amp;gt;, index = 0x7ffff7c25690 &amp;lt;encoding_index&amp;gt;, rindex
  = 0x7ffff7c257a0 &amp;lt;encoding_rindex&amp;gt;, hash = 0x7ffff7c25a20 &amp;lt;encoding_hash&amp;gt;, scan =
  0x7ffff7c29380 &amp;lt;utf8_scan&amp;gt;, partial_scan = 0x7ffff7c29460 &amp;lt;utf8_partial_scan&amp;gt;, ord
  = 0x7ffff7c297e0 &amp;lt;utf8_ord&amp;gt;, substr = 0x7ffff7c25de0 &amp;lt;encoding_substr&amp;gt;, is_cclass =
  0x7ffff7c26000 &amp;lt;encoding_is_cclass&amp;gt;, find_cclass =
  0x7ffff7c260e0 &amp;lt;encoding_find_cclass&amp;gt;, find_not_cclass =
  0x7ffff7c26220 &amp;lt;encoding_find_not_cclass&amp;gt;, get_graphemes =
  0x7ffff7c263d0 &amp;lt;encoding_get_graphemes&amp;gt;, compose =
  0x7ffff7c27680 &amp;lt;unicode_compose&amp;gt;, decompose = 0x7ffff7c26450 &amp;lt;encoding_decompose&amp;gt;,
  upcase = 0x7ffff7c27b20 &amp;lt;unicode_upcase&amp;gt;, downcase =
  0x7ffff7c27be0 &amp;lt;unicode_downcase&amp;gt;, titlecase = 0x7ffff7c27ca0 &amp;lt;unicode_titlecase&amp;gt;,
  upcase_first = 0x7ffff7c27d60 &amp;lt;unicode_upcase_first&amp;gt;, downcase_first =
  0x7ffff7c27dc0 &amp;lt;unicode_downcase_first&amp;gt;, titlecase_first =
  0x7ffff7c27e20 &amp;lt;unicode_titlecase_first&amp;gt;, iter_get =
  0x7ffff7c29c40 &amp;lt;utf8_iter_get&amp;gt;, iter_skip = 0x7ffff7c29d60 &amp;lt;utf8_iter_skip&amp;gt;,
  iter_get_and_advance = 0x7ffff7c29eb0 &amp;lt;utf8_iter_get_and_advance&amp;gt;,
  iter_set_and_advance = 0x7ffff7c29fd0 &amp;lt;utf8_iter_set_and_advance&amp;gt;}&lt;/pre&gt;
&lt;h2&gt;encode_base64(str)&lt;/h2&gt;
&lt;pre&gt;$ perl -MMIME::Base64 -lE'$x=&quot;20e3&quot;;$s=&quot;\x{20e3}&quot;;
  printf &quot;0x%s\t%s=&amp;gt; %s&quot;,$x,$s,encode_base64($s)'
Wide character in subroutine entry at -e line 1.&lt;/pre&gt;
&lt;p&gt;Oops, I’m clearly a unicode perl5 newbie. Does my term not understand utf-8?&lt;/p&gt;
&lt;pre&gt;$ echo $TERM
xterm&lt;/pre&gt;
&lt;p&gt;No, it should. encode_base64 does not understand unicode.&lt;br /&gt;
&lt;code&gt;perldoc MIME::Base64&lt;/code&gt;&lt;br /&gt;
&lt;i&gt;“The base64 encoding is only defined for single-byte characters. Use the Encode module to select the byte encoding you want.”&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Oh my! But it is just perl5. It just works on byte buffers, not on strings.&lt;br /&gt;
perl5 strings can be utf8 and non-utf8. Why on earth an utf8 encoded string is disallowed and only byte buffers of unknown encodings are allowed goes beyond my understanding, but what can you do. Nothing. base64 is a binary only protocol, based on byte buffers. So we decode it manually to byte buffers. The Encode API for decoding is called &lt;i&gt;encode&lt;/i&gt;.&lt;/p&gt;
&lt;pre&gt;$ perl -MMIME::Base64 -MEncode -lE'$x=&quot;20e3&quot;;$s=&quot;\x{20e3}&quot;;
  printf &quot;0x%s\t%s=&amp;gt; %s&quot;,$x,$s,encode_base64(encode('utf8',$s))'
Wide character in printf at -e line 1.
0x20e3	=&amp;gt; 4oOj&lt;/pre&gt;
&lt;p&gt;This is now the term warning I know. We need &lt;strong&gt;-C&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;$ &lt;strong&gt;perldoc perluniintro&lt;/strong&gt;

$ perl -C -MMIME::Base64 -MEncode -lE'$x=&quot;20e3&quot;;$s=&quot;\x{20e3}&quot;;
  printf &quot;0x%s\t%s=&amp;gt; %s&quot;,$x,$s,encode_base64(encode('utf8',$s))'
0x20e3	=&amp;gt; 4oOj&lt;/pre&gt;
&lt;p&gt;Over to rakudo/perl6 and parrot:&lt;/p&gt;
&lt;pre&gt;$ cat &amp;gt;m.pir &amp;lt;&amp;lt; EOP
.sub main :main
    load_bytecode 'MIME/Base64.pbc'
    $P1 = get_global [ &quot;MIME&quot;; &quot;Base64&quot; ], 'encode_base64'
    $S1 = utf8:&quot;\x{203e}&quot;
    $S2 = $P1(s1)
    say $S1
    say $S2
.end
EOP

$ parrot m.pir
FixedIntegerArray: index out of bounds!
current instr.: 'parrot;MIME;Base64;encode_base64'
                pc 163 (runtime/parrot/library/MIME/Base64.pir:147)&lt;/pre&gt;
&lt;p&gt;The perl6 test, using the parrot library, from &lt;a href=&quot;https://github.com/ronaldxs/perl6-Enc-MIME-Base64/&quot;&gt;https://github.com/ronaldxs/perl6-Enc-MIME-Base64/&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;$ git clone git://github.com/ronaldxs/perl6-Enc-MIME-Base64.git
Cloning into 'perl6-Enc-MIME-Base64'...

$ PERL6LIB=perl6-Enc-MIME-Base64/lib perl6 &amp;lt;&amp;lt;EOP
use Enc::MIME::Base64;
say encode_base64_str(&quot;\x203e&quot;);
EOP

&amp;gt; use Enc::MIME::Base64;
Nil
&amp;gt; say encode_base64_str(&quot;\x203e&quot;);
FixedIntegerArray: index out of bounds!
...&lt;/pre&gt;
&lt;p&gt;The pure perl6 workaround:&lt;/p&gt;
&lt;pre&gt;$ PERL6LIB=perl6-Enc-MIME-Base64/lib perl6 &amp;lt;&amp;lt;EOP
use PP::Enc::MIME::Base64;
say encode_base64_str(&quot;\x203e&quot;);
EOP

&amp;gt; use PP::Enc::MIME::Base64;
Nil
&amp;gt; say encode_base64_str(&quot;\x203e&quot;);
4oC+&lt;/pre&gt;
&lt;p&gt;Wait. perl6 creates a different enoding than perl5?&lt;br /&gt;
What about coreutils &lt;a href=&quot;http://www.gnu.org/software/coreutils/manual/html_node/base64-invocation.html&quot;&gt;base64&lt;/a&gt; command.&lt;/p&gt;
&lt;pre&gt;$ echo -n &quot;‾&quot; &amp;gt; m.raw
$ od -x m.raw
0000000 80e2 00be
0000003
$ ls -al m.raw
-rw-r--r-- 1 rurban rurban 3 Dec  6 10:23 m.raw
$ base64 m.raw
4oC+&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;[80e2 00be]&lt;/code&gt; is the little-endian version of &lt;code&gt;[e2 80 be]&lt;/code&gt;, 3 bytes, flipped.&lt;br /&gt;
Ok, at least base64 agrees with perl6, and I must have made some encoding mistake with perl5.&lt;/p&gt;
&lt;p&gt;Back to debugging our parrot problem:&lt;/p&gt;
&lt;p&gt;parrot unlike perl6 has no debugger yet. So we have to use &lt;code&gt;gdb&lt;/code&gt;, and we need to know in which function the error occured. We use the parrot &lt;code&gt;-t&lt;/code&gt; trace flag, which is like the perl5 debugging &lt;code&gt;-Dt&lt;/code&gt; flag, but it is always enabled, even in optimized builds.&lt;/p&gt;
&lt;pre&gt;$ parrot --help
...
    -t --trace [flags] 
    --help-debug
...
$ parrot --help-debug
...
--trace -t [Flags] ...
    0001    opcodes
    0002    find_method
    0004    function calls

$ parrot -t7 m.pir
...
009f band I9, I2, 63         I9=0 I2=0 
00a3 set I10, P0[I5]         I10=0 P0=&lt;strong&gt;FixedIntegerArray&lt;/strong&gt;=PMC(0xff7638) I5=[&lt;strong&gt;2063&lt;/strong&gt;]
016c get_results PC2 (1), P2 PC2=FixedIntegerArray=PMC(0xedd178) P2=PMCNULL
016f finalize P2             P2=Exception=PMC(0x16ed498)
0171 pop_eh
&lt;i&gt;lots of error handling&lt;/i&gt;
...
0248 callmethodcc P0, &quot;print&quot; P0=FileHandle=PMC(0xedcca0) 
FixedIntegerArray: index out of bounds!&lt;/pre&gt;
&lt;p&gt;We finally see the problem, which matches the run-time error.&lt;/p&gt;
&lt;pre&gt;00a3 &lt;strong&gt;set I10, P0[I5]&lt;/strong&gt;         I10=0 P0=&lt;strong&gt;FixedIntegerArray&lt;/strong&gt;=PMC(0xff7638) I5=[&lt;strong&gt;2063&lt;/strong&gt;]&lt;/pre&gt;
&lt;p&gt;We want to set I10 to the I5=2063′th element in the FixedIntegerArray P0, and the array is not big enough.&lt;/p&gt;
&lt;p&gt;After several hours of analyzing I came to the conclusion that the parrot library MIME::Base64 was wrong by using &lt;strong&gt;ord&lt;/strong&gt; of every character in the string. It should use a &lt;strong&gt;bytebuffer&lt;/strong&gt; instead.&lt;br /&gt;
Which was fixed with &lt;a href=&quot;https://github.com/parrot/parrot/commit/3a48e6b462d8fff501cb16a2f92a857baee0df53&quot;&gt;commit 3a48e6&lt;/a&gt;. ord can return integers &amp;gt; 255, but base64 can only handle chars &amp;lt; 255.&lt;/p&gt;
&lt;p&gt;The fixed parrot library was now correct:&lt;/p&gt;
&lt;pre&gt;$ parrot m.pir
‾
4oC+&lt;/pre&gt;
&lt;p&gt;But then the tests started failing. I spent several weeks trying to understand why the parrot testsuite was wrong with the mime_base64 tests, the testdata came from perl5. I came up with different implementation hacks which would match the testsuite, but finally had to bite the bullet, changing the tests to match the implementation.&lt;/p&gt;
&lt;p&gt;And I had to special case the tests for big-endian, as base64 is endian agnostic. You cannot decode a base64 encoded powerpc file on an intel machine, when you use multi-byte characters. And utf-8 is even more multi-byte than ucs-2. I had to accept the fact the big-endian will return a different encoding. Before the results were the same. The tests were written to return the same encoding on little and big-endian.&lt;/p&gt;
&lt;h2&gt;Summary&lt;/h2&gt;
&lt;p&gt;The first reason why I wrote this blog post was to show how to debug into crazy problems like this, when you are not sure if the core implementation, the library, the spec or the tests are wrong. It turned out, that the library and the tests were wrong.&lt;br /&gt;
You saw how easily you could use gdb to debug into such problems, as soon as you find out a proper breakpoint.&lt;/p&gt;
&lt;p&gt;The internal string representations looked like this:&lt;/p&gt;
&lt;p&gt;MIME::Base64 internally:&lt;/p&gt;
&lt;pre&gt;len=1, encoding=utf-8, buf=[3e20]&lt;/pre&gt;
&lt;p&gt;and inside the parrot imcc compiler the SREG&lt;/p&gt;
&lt;pre&gt;len=8, buf=&quot;utf-8:\&quot;\x{203e}\&quot;&quot;&lt;/pre&gt;
&lt;p&gt;parrot is a register based runtime, and a SREG is the string representation of the register value. Unfortunately a SREG cannot hold the encoding info yet, so we prefix the encoding in the string, and unquote it back. This is not the reason why parrot is still slower than the perl5 VM. I &lt;a href=&quot;https://github.com/parrot/parrot/commit/9c8159314dd2d26365653fbcd8627b0f8fbb0559&quot;&gt;benchmarked&lt;/a&gt; it. parrot still uses too much sprintf’s internally and the encoding quote/unquoting counts only for a 4th of the time of the sprintf gyrations.&lt;br /&gt;
And parrot function calls are awfully slow and de-optimized.&lt;/p&gt;
&lt;p&gt;The second reason is to explain the new decode_base64() API, which only parrot – and therefore all parrot based languages like rakudo – now have got.&lt;/p&gt;
&lt;h2&gt;decode_base64(str, ?:encoding)&lt;/h2&gt;
&lt;p&gt;&lt;i&gt;“Decode a base64 string by calling the decode_base64() function.&lt;br /&gt;
This function takes as first argument the string to decode, as optional second argument the encoding string for the decoded data.&lt;br /&gt;
It returns the decoded data.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Any character not part of the 65-character base64 subset is silently ignored.&lt;br /&gt;
Characters occurring after a ‘=’ padding character are never decoded.”&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;So decode_base64 got now a second optional encoding argument. The src string for encode_base64 can be any encoding and is automatically decoded to a bytebuffer. You can easily encode an image or unicode string without any trouble, and for the decoder you can define the wanted encoding beforehand. The result can be the encoding &lt;strong&gt;binary&lt;/strong&gt; or &lt;strong&gt;utf-8&lt;/strong&gt; or any encoding you prefer, no need for additional decoding of the result. The default encoding of the decoded string is either ascii, latin-1 or utf-8. parrot will upgrade the encoding automatically.&lt;/p&gt;
&lt;p&gt;You can compare the new examples of &lt;a href=&quot;https://github.com/parrot/parrot/blob/master/examples/library/utf8_base64.pir&quot;&gt;pir&lt;/a&gt; against the &lt;a href=&quot;https://github.com/parrot/parrot/blob/master/examples/library/utf8_base64.pl&quot;&gt;perl5&lt;/a&gt; version:&lt;/p&gt;
&lt;p&gt;parrot:&lt;/p&gt;
&lt;pre&gt;.sub main :main
    load_bytecode 'MIME/Base64.pbc'

    .local pmc enc_sub
    enc_sub = get_global [ &quot;MIME&quot;; &quot;Base64&quot; ], 'encode_base64'

    .local string result_encode
    # GH 814
    result_encode = enc_sub(utf8:&quot;\x{a2}&quot;)
    say   &quot;encode:   utf8:\&quot;\\x{a2}\&quot;&quot;
    say   &quot;expected: wqI=&quot;
    print &quot;result:   &quot;
    say result_encode

    # GH 813
    result_encode = enc_sub(utf8:&quot;\x{203e}&quot;)
    say   &quot;encode:   utf8:\&quot;\\x{203e}\&quot;&quot;
    say   &quot;expected: 4oC+&quot;
    print &quot;result:   &quot;
    say result_encode

.end&lt;/pre&gt;
&lt;p&gt;perl5:&lt;/p&gt;
&lt;pre&gt;use MIME::Base64 qw(encode_base64 decode_base64);
use Encode qw(encode);

my $encoded = encode_base64(encode(&quot;UTF-8&quot;, &quot;\x{a2}&quot;));
print  &quot;encode:   utf-8:\&quot;\\x{a2}\&quot;  - &quot;, encode(&quot;UTF-8&quot;, &quot;\x{a2}&quot;), &quot;\n&quot;;
print  &quot;expected: wqI=\n&quot;;
print  &quot;result:   $encoded\n&quot;;
print  &quot;decode:   &quot;,decode_base64(&quot;wqI=&quot;),&quot;\n\n&quot;; # 302 242

my $encoded = encode_base64(encode(&quot;UTF-8&quot;, &quot;\x{203e}&quot;));
print  &quot;encode:   utf-8:\&quot;\\x{203e}\&quot;  -&amp;gt; &quot;,encode(&quot;UTF-8&quot;, &quot;\x{203e}&quot;),&quot;\n&quot;;
print  &quot;expected: 4oC+\n&quot;;
print  &quot;result:   $encoded\n&quot;; # 342 200 276
print  &quot;decode:   &quot;,decode_base64(&quot;4oC+&quot;),&quot;\n&quot;;

for ([qq(a2)],[qq(c2a2)],[qw(203e)],[qw(3e 20)],[qw(1000)],[qw(00c7)],[qw(00ff 0000)]){
    $s = pack &quot;H*&quot;,@{$_};
    printf &quot;0x%s\t=&amp;gt; %s&quot;, join(&quot;&quot;,@{$_}), encode_base64($s);
}&lt;/pre&gt;
&lt;p&gt;perl6:&lt;/p&gt;
&lt;pre&gt;use Enc::MIME::Base64;
say encode_base64_str(&quot;\xa2&quot;);
say encode_base64_str(&quot;\x203e&quot;);&lt;/pre&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1217/&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/1217/&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=1217&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>rurban</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 6 – Lexical Imports</title>
		<link href="http://perl6advent.wordpress.com/2012/12/06/day-6-lexical-imports/"/>
		<id>http://perl6advent.wordpress.com/?p=1157</id>
		<updated>2012-12-06T00:00:44+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Perl 6 is built on lexical scopes. Variables, subroutines, constants and even types are looked up lexically first, and subroutines are only looked up in lexical scopes.&lt;/p&gt;
&lt;p&gt;So it is only fitting that importing symbols from modules is also done into lexical scopes. I often write code such as&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    use v6;

    # the main functionality of the script
    sub deduplicate(Str $s) {
        my %seen;
        $s.comb.grep({!%seen{ .lc }++}).join;
    }

    # normal call
    multi MAIN($phrase) {
        say deduplicate($phrase)
    }

    # if you call the script with --test, it runs its unit tests
    multi MAIN(Bool :$test!) {
        # imports &amp;amp;plan, &amp;amp;is etc. only into the lexical scope
        use Test;
        plan 2;
        is deduplicate('just some words'),
            'just omewrd', 'basic deduplication';
        is deduplicate('Abcabd'),
            'Abcd', 'case insensitivity';
    }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This script removes all but the first occurrence of each character given on the command line:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    $ perl6 deduplicate 'Duplicate character removal'
    Duplicate hrmov&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But if you call it with the &lt;code&gt;--test&lt;/code&gt; option, it runs its own unit tests:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    $ perl6 deduplicate --test
    1..2
    ok 1 - basic deduplication
    ok 2 - case insensitivity&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since the testing functions are only necessary in a part of the program — in a lexical scope, to be more precise –, the &lt;code&gt;use&lt;/code&gt; statement is inside that scope, and limits the visibility of the imported symbols to this scope. So if you try to use the &lt;code&gt;is&lt;/code&gt; function outside the routine in which &lt;code&gt;Test&lt;/code&gt; is used, you get a compile-time error.&lt;/p&gt;
&lt;p&gt;Why, you might ask? From the programmer's perspective, it reduces risk of (possibly unintended and unnoticed) name clashes the same way that lexical variables are safer than global variables.&lt;/p&gt;
&lt;p&gt;From the point of view of language design, the combination of lexical importing, runtime-immutable lexical scopes and lexical-only lookup of subroutines allows resolving subroutine names at compile time, which again allows neat stuff like detecting calls to undeclared functions, compile-time type checking of arguments, and other nice optimizations.&lt;/p&gt;
&lt;p&gt;But subroutines are only the tip of the iceberg. Perl 6 has a very flexible syntax, which you can modify with custom operators and macros. Those too can be exported, and imported into lexical scopes. Which means that language modifications are also lexically by default. So you can safely load any language-modifying extension, without running into danger that a library you use can't cope with it — the library doesn't even see the language modification.&lt;/p&gt;
&lt;p&gt;So ultimately, lexical importing is another facet of encapsulation.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1157/&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/1157/&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=1157&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 5 – A Perl 6 Debugger</title>
		<link href="http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/"/>
		<id>http://perl6advent.wordpress.com/?p=1195</id>
		<updated>2012-12-05T00:01:22+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;There’s much more to the developer experience of a language than its design, features and implementations. While the language and its implementations are perhaps the thing developers will spend most time with, the overall experience will also involve interaction with the community, reading documentation, using modules and employing various development tools. Thus, it’s important that Perl 6 make progress on these fronts too. Over the past year, we’ve taken some good steps forward in these areas; there’s now &lt;a href=&quot;http://doc.perl6.org/&quot;&gt;doc.perl6.org&lt;/a&gt;, the module ecosystem has grown, and the module installation tooling has improved. Another big step forward with regards to tooling – and the topic of this post – is that an interactive Perl 6 debugger is now available.&lt;/p&gt;
&lt;h3&gt;Running With The Debugger&lt;/h3&gt;
&lt;p&gt;The debugger has been included with the last few Rakudo * releases. If you have one of those, you’re all set. Just run &lt;strong&gt;perl6-debug&lt;/strong&gt; instead of &lt;strong&gt;perl6&lt;/strong&gt;. It takes the same set of options, so if your normal invocation involves, for example, using the &lt;strong&gt;-I&lt;/strong&gt; flag to set the include path for modules, it’ll Just Work Like Usual. Of course, what happens next is entirely different. The debugger will show you each module it is loading, followed by placing you at the first interesting statement of the program, highlighted in yellow.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/dbg0/&quot; rel=&quot;attachment wp-att-1197&quot;&gt;&lt;img alt=&quot;dbg0&quot; class=&quot;alignnone  wp-image-1197&quot; height=&quot;225&quot; src=&quot;http://perl6advent.files.wordpress.com/2012/12/dbg0.png?w=591&amp;amp;h=225&quot; width=&quot;591&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note how it takes care to put you on the first line that actually does something, skipping the my statement above it (it’s getting increasingly smart about this).&lt;/p&gt;
&lt;h3&gt;The Basics&lt;/h3&gt;
&lt;p&gt;Hitting enter allows you to single-step through the program. At any point, you can look at variables, call methods on variables, or even evaluate expressions.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/dbg1/&quot; rel=&quot;attachment wp-att-1198&quot;&gt;&lt;img alt=&quot;dbg1&quot; class=&quot;alignnone  wp-image-1198&quot; height=&quot;221&quot; src=&quot;http://perl6advent.files.wordpress.com/2012/12/dbg1.png?w=623&amp;amp;h=221&quot; width=&quot;623&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you want to move statement by statement, but never descend into a function call or method call, type an &lt;strong&gt;s&lt;/strong&gt;, followed by enter. To step out of the current sub (that is, run until it returns then break in its caller), use &lt;strong&gt;so&lt;/strong&gt; to step out. To run the program until it hits an exception, just use &lt;strong&gt;r&lt;/strong&gt;. Even at the point you get an exception, you can still access variables to try and dissect what went wrong.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/dbg2/&quot; rel=&quot;attachment wp-att-1199&quot;&gt;&lt;img alt=&quot;dbg2&quot; class=&quot;alignnone  wp-image-1199&quot; height=&quot;377&quot; src=&quot;http://perl6advent.files.wordpress.com/2012/12/dbg2.png?w=560&amp;amp;h=377&quot; width=&quot;560&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;One final variant, &lt;strong&gt;rt&lt;/strong&gt;, will run until an exception is thrown, but handled. You’ll break at the point of the throw. This means you’re not disadvantaged in the debugger if you took care to handle exceptions well in your program; you can still break when they are thrown and use the debugger to help understand why. :-)&lt;/p&gt;
&lt;h3&gt;Breakpoints&lt;/h3&gt;
&lt;p&gt;Sometimes, you know exactly where the juicy stuff happens in your program that you wish to debug. If only you could just run until you got there. Turns out you can – that’s what breakpoints are for. We can add one, use &lt;strong&gt;r&lt;/strong&gt; to run, and it will stop where we placed the breakpoint.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/dbg3/&quot; rel=&quot;attachment wp-att-1200&quot;&gt;&lt;img alt=&quot;dbg3&quot; class=&quot;alignnone  wp-image-1200&quot; height=&quot;395&quot; src=&quot;http://perl6advent.files.wordpress.com/2012/12/dbg3.png?w=556&amp;amp;h=395&quot; width=&quot;556&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that you don’t have to type out the full name of the file you want to put the breakpoint in; any unambiguous substring of the name of a file that is loaded will be sufficient.&lt;/p&gt;
&lt;p&gt;I won’t cover them here, but there are also tracepoints, which instead of breaking will log the value of an expression each time a certain place in the program is hit. Later, you can display the log. It’s like adding print statements, but without the print statement going in your code, removing the risk of them accidentally making it into a commit (‘cus we’ve all done that one, right? :-))&lt;/p&gt;
&lt;h3&gt;Regex and Grammar Debugging&lt;/h3&gt;
&lt;p&gt;When the debugger detects you are in a regex or grammar, it offers a little extra help. As well as allowing you to single-step your way through the regex, atom by atom, it also displays the match text, indicating what has been matched so far.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/dbg4/&quot; rel=&quot;attachment wp-att-1201&quot;&gt;&lt;img alt=&quot;dbg4&quot; class=&quot;alignnone  wp-image-1201&quot; height=&quot;197&quot; src=&quot;http://perl6advent.files.wordpress.com/2012/12/dbg4.png?w=543&amp;amp;h=197&quot; width=&quot;543&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here, you can see that the pattern already successfully matched SELECT, and is now looking for a literal * or will try to call the field list rule. If in a regex, which may backtrack, the match position  jumps backwards when backtracking happens, so you can understand the backtracking behavior of the pattern.&lt;/p&gt;
&lt;h3&gt;Yes, Perl 5 Regexes Too!&lt;/h3&gt;
&lt;p&gt;Rakudo has some support for the :P5 adverb on regexes, which allows use of the Perl 5 regex syntax. Here the debugger is used in REPL mode (where you enter an expression, then can immediately debug it) to explore the difference between alternations in Perl 5 and Perl 6 (in Perl 5 they go left to right, in Perl 6 they have longest token matching semantics, such that it tries the thing that will match most characters first).&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/dbg5/&quot; rel=&quot;attachment wp-att-1202&quot;&gt;&lt;img alt=&quot;dbg5&quot; class=&quot;alignnone  wp-image-1202&quot; height=&quot;423&quot; src=&quot;http://perl6advent.files.wordpress.com/2012/12/dbg5.png?w=545&amp;amp;h=423&quot; width=&quot;545&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The debugger in REPL mode is great for exploring and understanding how things will execute (and as such can serve as a learning or teaching aid). Another use is for debugging modules without having to write a test script; just write a &lt;strong&gt;use&lt;/strong&gt; statement in the debugger or you can even supply the module using the &lt;strong&gt;-M&lt;/strong&gt; command line flag and the debugger will load it!&lt;/p&gt;
&lt;h3&gt;What About Funky Stuff, Like Macros?&lt;/h3&gt;
&lt;p&gt;That is, macros, &lt;strong&gt;BEGIN&lt;/strong&gt; time, &lt;strong&gt;eval&lt;/strong&gt;, and those other things where your Perl 6 program does the time warp again, doing a bit of runtime at compile time or compiling some more stuff at runtime. The debugger is built for it. If a macro is applied, the debugger will place you in it. Notice below how we’re still in the process of loading the second file, and did not get to the third yet – we really are debugging at &lt;strong&gt;BEGIN&lt;/strong&gt; time!&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/dbg6/&quot; rel=&quot;attachment wp-att-1203&quot;&gt;&lt;img alt=&quot;dbg6&quot; class=&quot;alignnone  wp-image-1203&quot; height=&quot;202&quot; src=&quot;http://perl6advent.files.wordpress.com/2012/12/dbg6.png?w=556&amp;amp;h=202&quot; width=&quot;556&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Any lines of code that are stripped out by the macro are simply never hit at runtime. And what about statements in quasi blocks? The debugger will take you there, so you not only know what macro was applied, but can dig into exactly what it does too.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://perl6advent.wordpress.com/2012/12/05/a-perl-6-debugger/dbg7/&quot; rel=&quot;attachment wp-att-1204&quot;&gt;&lt;img alt=&quot;dbg7&quot; class=&quot;alignnone  wp-image-1204&quot; height=&quot;306&quot; src=&quot;http://perl6advent.files.wordpress.com/2012/12/dbg7.png?w=585&amp;amp;h=306&quot; width=&quot;585&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Just as bits of runtime happening at compile time work out fine, any code that gets &lt;strong&gt;eval&lt;/strong&gt;‘d at runtime is also compiled with debug hooks, meaning that you can step straight into it and debug the evaluated code.&lt;/p&gt;
&lt;h3&gt;Written in Perl 6 and NQP!&lt;/h3&gt;
&lt;p&gt;You might think that writing a debugger must involve all kinds of low-level hackery. In fact, that’s not the case. The debug hooks mechanism is &lt;a href=&quot;https://github.com/jnthn/rakudo-debugger/blob/master/bin/perl6-debug.nqp&quot;&gt;written in NQP&lt;/a&gt;, and the command line user interface is &lt;a href=&quot;https://github.com/jnthn/rakudo-debugger/blob/master/lib/Debugger/UI/CommandLine.pm&quot;&gt;written in Perl 6&lt;/a&gt;. This is significant from a couple of angles. The first is the fact that we can write something like this without breaking the encapsulation of the compiler, but instead just by subclassing the Grammar, Actions and Compiler objects and twiddling with the AST. In fact, the debugger was built without any changes being required to Rakudo as it already existed. This provides important feedback on our compiler architecture – this time, very positive feedback. Things are extensible in the ways they were designed to be. The second is that writing so much of it in Perl 6 is a healthy bit of dogfooding – using the product in order to build further products. My hope is that, since most of what people would want to change is actually written in the Perl 6 part, it will feel quite hackable by the community at large.&lt;/p&gt;
&lt;h3&gt;And What Of Future Plans?&lt;/h3&gt;
&lt;p&gt;Various features are still to come: conditional breakpoints, dumping tracepoint output to a file, showing the path taken through a grammar to get to the current point, and various bits of configurability. The command line interface is nice, but of course having some extra options would be even nicer. I’m interested in a web-based interface, but also in integration with tools like Padre. There’s some work afoot on a &lt;a href=&quot;https://github.com/kevindawson/Bullwinkle/wiki&quot;&gt;common protocol&lt;/a&gt; for these things, which could make such integration possible without having to re-invent too many wheels. In the meantime, having an interactive debugger which is aware of and works well with a wide range of Perl 6 language features is a solid step forward. Happy debugging, and feature ideas (or patches ;-)) are welcome; here’s the &lt;a href=&quot;https://github.com/jnthn/rakudo-debugger&quot;&gt;GitHub repo&lt;/a&gt;!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1195/&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/1195/&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=1195&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 4 – Having Fun with Rakudo and Project Euler</title>
		<link href="http://perl6advent.wordpress.com/2012/12/04/day-4-having-fun-with-rakudo-and-project-euler/"/>
		<id>http://perl6advent.wordpress.com/?p=1164</id>
		<updated>2012-12-04T00:01:40+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Rakudo, the leading Perl6 implementation, is not perfect, and performance is a particularly sore subject. However, the pioneer does not ask &lt;em&gt;‘Is it fast?’&lt;/em&gt;, but rather &lt;em&gt;‘Is it fast enough?’&lt;/em&gt;, or perhaps even &lt;em&gt;‘How can I help to make it faster?’&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;To convince you that Rakudo can indeed be fast enough, we’ll take a shot at a bunch of &lt;a href=&quot;http://projecteuler.net&quot;&gt;Project Euler&lt;/a&gt; problems. Many of those involve brute-force numerics, and that’s something Rakudo isn’t particularly good at right now. However, that’s not necessarily a show stopper: The less performant the language, the more ingenious the programmer needs to be, and that’s where the fun comes in.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;All code has been tested with Rakudo 2012.11.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;We’ll start with something simple:&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Problem 2&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The solution is beautifully straight-forward:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    say [+] grep * %% 2, (1, 2, *+* ...^ * &amp;gt; 4_000_000);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: 0.4s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note how using operators can lead to code that’s both compact and readable (opinions may vary, of course). We used&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;whatever stars &lt;code&gt;*&lt;/code&gt; to create lambda functions&lt;/li&gt;
&lt;li&gt;the sequence operator (in its variant that excludes the right endpoint) &lt;code&gt;...^&lt;/code&gt; to build up the Fibonacci sequence&lt;/li&gt;
&lt;li&gt;the divisible-by operator &lt;code&gt;%%&lt;/code&gt; to grep the even terms&lt;/li&gt;
&lt;li&gt;reduction by plus &lt;code&gt;[+]&lt;/code&gt; to sum them.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;However, no one forces you to go crazy with operators – there’s nothing wrong with vanilla imperative code:&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Problem 3&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;What is the largest prime factor of the number 600,851,475,143?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;An imperative solution looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    sub largest-prime-factor($n is copy) {
        for 2, 3, *+2 ... * {
            while $n %% $_ {
                $n div= $_;
                return $_ if $_ &amp;gt; $n;
            }
        }
    }

    say largest-prime-factor(600_851_475_143);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: 2.6s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note the &lt;code&gt;is copy&lt;/code&gt; trait, which is necessary as Perl6 binds arguments read-only by default, and that integer division &lt;code&gt;div&lt;/code&gt; is used instead of numeric division &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Nothing fancy going on here, so we’ll move along to&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Problem 53&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;How many, not necessarily distinct, values of &lt;sup&gt;n&lt;/sup&gt;C&lt;sub&gt;r&lt;/sub&gt;, for 1 ≤ n ≤ 100, are greater than one-million?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We’ll use the feed operator &lt;code&gt;==&amp;gt;&lt;/code&gt; to factor the algorithm into separate steps:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    [1], -&amp;gt; @p { [0, @p Z+ @p, 0] } ... * # generate Pascal's triangle
    ==&amp;gt; (*[0..100])()                     # get rows up to n = 100
    ==&amp;gt; map *.list                        # flatten rows into a single list
    ==&amp;gt; grep * &amp;gt; 1_000_000                # filter elements exceeding 1e6
    ==&amp;gt; elems()                           # count elements
    ==&amp;gt; say;                              # output result
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: 5.2s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note the use of the &lt;code&gt;Z&lt;/code&gt; meta-operator to zip the lists &lt;code&gt;0, @p&lt;/code&gt; and &lt;code&gt;@p, 0&lt;/code&gt; with &lt;code&gt;+&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The one-liner generating Pascal’s triangle has been stolen from &lt;a href=&quot;http://rosettacode.org/wiki/Pascal%27s_triangle#Perl_6&quot;&gt;Rosetta Code&lt;/a&gt;, another great resource for anyone interested in Perl6 snippets and exercises.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Let’s do something clever now:&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Problem 9&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Using brute force &lt;a href=&quot;https://github.com/perl6/perl6-examples/blob/master/euler/prob009-polettix.pl&quot;&gt;will work&lt;/a&gt; (solution courtesy of Polettix), but it won’t be fast (~11s on my machine). Therefore, we’ll use a bit of algebra to make the problem more managable:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Let &lt;code&gt;(a, b, c)&lt;/code&gt; be a Pythagorean triplet&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    a &amp;lt; b &amp;lt; c
    a² + b² = c²
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For &lt;code&gt;N = a + b + c&lt;/code&gt; it follows&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    b = N·(N - 2a) / 2·(N - a)
    c = N·(N - 2a) / 2·(N - a) + a²/(N - a)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which automatically meets &lt;code&gt;b &amp;lt; c&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The condition &lt;code&gt;a &amp;lt; b&lt;/code&gt; gives the constraint&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    a &amp;lt; (1 - 1/√2)·N
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;We arrive at&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    sub triplets(\N) {
        for 1..Int((1 - sqrt(0.5)) * N) -&amp;gt; \a {
            my \u = N * (N - 2 * a);
            my \v = 2 * (N - a);

            # check if b = u/v is an integer
            # if so, we've found a triplet
            if u %% v {
                my \b = u div v;
                my \c = N - a - b;
                take $(a, b, c);
            }
        }
    }

    say [*] .list for gather triplets(1000);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: 0.5s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note the declaration of sigilless variables &lt;code&gt;\N&lt;/code&gt;, &lt;code&gt;\a&lt;/code&gt;, …, how &lt;code&gt;$(…)&lt;/code&gt; is used to return the triplet as a single item and &lt;code&gt;.list&lt;/code&gt; – a shorthand for &lt;code&gt;$_.list&lt;/code&gt; – to restore listy-ness.&lt;/p&gt;
&lt;p&gt;The sub &lt;code&gt;&amp;amp;triplets&lt;/code&gt; acts as a generator and uses &lt;code&gt;&amp;amp;take&lt;/code&gt; to yield the results. The corresponding &lt;code&gt;&amp;amp;gather&lt;/code&gt; is used to delimit the (dynamic) scope of the generator, and it could as well be put into &lt;code&gt;&amp;amp;triplets&lt;/code&gt;, which would end up returning a lazy list.&lt;/p&gt;
&lt;p&gt;We can also rewrite the algorithm into dataflow-driven style using feed operators:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    constant N = 1000;

    1..Int((1 - sqrt(0.5)) * N)
    ==&amp;gt; map -&amp;gt; \a { [ a, N * (N - 2 * a), 2 * (N - a) ] }
    ==&amp;gt; grep -&amp;gt; [ \a, \u, \v ] { u %% v }
    ==&amp;gt; map -&amp;gt; [ \a, \u, \v ] {
        my \b = u div v;
        my \c = N - a - b;
        a * b * c
    }
    ==&amp;gt; say;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: 0.5s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note how we use destructuring signature binding &lt;code&gt;-&amp;gt; […]&lt;/code&gt; to unpack the arrays that get passed around.&lt;/p&gt;
&lt;p&gt;There’s no practical benefit to use this particular style right now: In fact, it can easily hurt performance, and we’ll see an example for that later.&lt;/p&gt;
&lt;p&gt;It &lt;em&gt;is&lt;/em&gt; a great way to write down purely functional algorithms, though, which in principle would allow a sufficiently advanced optimizer to go wild (think of auto-vectorization and -threading). However, Rakudo has not yet reached that level of sophistication.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;But what to do if we’re not smart enough to find a clever solution?&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Problem 47&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;Find the first four consecutive integers to have four distinct prime factors. What is the first of these numbers?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is a problem where I failed to come up with anything better than brute force:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    constant $N = 4;

    my $i = 0;
    for 2..* {
        $i = factors($_) == $N ?? $i + 1 !! 0;
        if $i == $N {
            say $_ - $N + 1;
            last;
        }
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here, &lt;code&gt;&amp;amp;factors&lt;/code&gt; returns the number of prime factors. A naive implementations looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    sub factors($n is copy) {
        my $i = 0;
        for 2, 3, *+2 ...^ * &amp;gt; $n {
            if $n %% $_ {
                ++$i;
                repeat while $n %% $_ {
                    $n div= $_
                }
            }
        }
        return $i;
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: unknown (33s for N=3)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note the use of &lt;code&gt;repeat while … {…}&lt;/code&gt;, the new way to spell &lt;code&gt;do {…} while(…);&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;We can improve this by adding a bit of caching:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    BEGIN my %cache = 1 =&amp;gt; 0;

    multi factors($n where %cache) { %cache{$n} }
    multi factors($n) {
        for 2, 3, *+2 ...^ * &amp;gt; sqrt($n) {
            if $n %% $_ {
                my $r = $n;
                $r div= $_ while $r %% $_;
                return %cache{$n} = 1 + factors($r);
            }
        }
        return %cache{$n} = 1;
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: unknown (3.5s for N=3)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note the use of &lt;code&gt;BEGIN&lt;/code&gt; to initialize the cache first, regardless of the placement of the statement within the source file, and &lt;code&gt;multi&lt;/code&gt; to enable multiple dispatch for &lt;code&gt;&amp;amp;factors&lt;/code&gt;. The &lt;code&gt;where&lt;/code&gt; clause allows dynamic dispatch based on argument value.&lt;/p&gt;
&lt;p&gt;Even with caching, we’re still unable to answer the original question in a reasonable amount of time. So what do we do now? We cheat and use &lt;a href=&quot;https://github.com/jnthn/zavolaj&quot;&gt;Zavolaj&lt;/a&gt; – Rakudo’s version of NativeCall – to &lt;a href=&quot;https://github.com/perl6/perl6-examples/blob/master/euler/prob047-gerdr.c&quot;&gt;implement the factorization in C&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It turns out that’s still not good enough, so we refactor the remaining Perl code and add some native type annotations:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    use NativeCall;

    sub factors(int $n) returns int is native('./prob047-gerdr') { * }

    my int $N = 4;

    my int $n = 2;
    my int $i = 0;

    while $i != $N {
        $i = factors($n) == $N ?? $i + 1 !! 0;
        $n = $n + 1;
    }

    say $n - $N;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: 1m2s (0.8s for N=3)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For comparison, when implementing the algorithm completely in C, the runtime drops to under 0.1s, so Rakudo won’t win any speed contests just yet.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;As an encore, three ways to do one thing:&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Problem 29&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;How many distinct terms are in the sequence generated by a&lt;sup&gt;b&lt;/sup&gt; for 2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A beautiful but slow solution to the problem can be used to verify that the other solutions work correctly:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    say +(2..100 X=&amp;gt; 2..100).classify({ .key ** .value });
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: 11s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note the use of &lt;code&gt;X=&amp;gt;&lt;/code&gt; to construct the cartesian product with the pair constructor &lt;code&gt;=&amp;gt;&lt;/code&gt; to prevent flattening.&lt;/p&gt;
&lt;p&gt;Because Rakudo supports big integer semantics, there’s no loss of precision when computing large numbers like 100&lt;sup&gt;100&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;However, we do not actually care about the power’s value, but can use base and exponent to uniquely identify the power. We need to take care as bases can themselves be powers of already seen values:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    constant A = 100;
    constant B = 100;

    my (%powers, %count);

    # find bases which are powers of a preceeding root base
    # store decomposition into base and exponent relative to root
    for 2..Int(sqrt A) -&amp;gt; \a {
        next if a ~~ %powers;
        %powers{a, a**2, a**3 ...^ * &amp;gt; A} = a X=&amp;gt; 1..*;
    }

    # count duplicates
    for %powers.values -&amp;gt; \p {
        for 2..B -&amp;gt; \e {
            # raise to power \e
            # classify by root and relative exponent
            ++%count{p.key =&amp;gt; p.value * e}
        }
    }

    # add +%count as one of the duplicates needs to be kept
    say (A - 1) * (B - 1) + %count - [+] %count.values;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: 0.9s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note that the sequence operator &lt;code&gt;...^&lt;/code&gt; infers geometric sequences if at least three elements are provided and that list assignment &lt;code&gt;%powers{…} = …&lt;/code&gt; works with an infinite right-hand side.&lt;/p&gt;
&lt;p&gt;Again, we can do the same thing in a dataflow-driven, purely-functional fashion:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    sub cross(@a, @b) { @a X @b }
    sub dups(@a) { @a - @a.uniq }

    constant A = 100;
    constant B = 100;

    2..Int(sqrt A)
    ==&amp;gt; map -&amp;gt; \a { (a, a**2, a**3 ...^ * &amp;gt; A) Z=&amp;gt; (a X 1..*).tree }
    ==&amp;gt; reverse()
    ==&amp;gt; hash()
    ==&amp;gt; values()
    ==&amp;gt; cross(2..B)
    ==&amp;gt; map -&amp;gt; \n, [\r, \e] { (r) =&amp;gt; e * n }
    ==&amp;gt; dups()
    ==&amp;gt; ((A - 1) * (B - 1) - *)()
    ==&amp;gt; say();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Runtime: 1.5s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note how we use &lt;code&gt;&amp;amp;tree&lt;/code&gt; to prevent flattening. We could have gone with &lt;code&gt;X=&amp;gt;&lt;/code&gt; instead of &lt;code&gt;X&lt;/code&gt; as before, but it would make destructuring via &lt;code&gt;-&amp;gt; \n, [\r, \e]&lt;/code&gt; more complicated.&lt;/p&gt;
&lt;p&gt;As expected, this solution doesn’t perform as well as the imperative one. I’ll leave it as an exercise to the reader to figure out how it works exactly ;)&lt;/p&gt;
&lt;h2&gt;That’s it&lt;/h2&gt;
&lt;p&gt;Feel free to add your own solutions to the &lt;a href=&quot;https://github.com/perl6/perl6-examples&quot;&gt;Perl6 examples repository&lt;/a&gt; under &lt;a href=&quot;https://github.com/perl6/perl6-examples/tree/master/euler&quot;&gt;euler/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you’re interested in bioinformatics, you should take a look at &lt;a href=&quot;http://rosalind.info&quot;&gt;Rosalind&lt;/a&gt; as well, which also has its own (currently only sparsely populated) examples directory &lt;a href=&quot;https://github.com/perl6/perl6-examples/tree/master/rosalind&quot;&gt;rosalind/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Last but not least, some solutions for the &lt;a href=&quot;http://shootout.alioth.debian.org/&quot;&gt;Computer Language Benchmarks Game&lt;/a&gt; – also known as the Debian language shootout – can be found under &lt;a href=&quot;https://github.com/perl6/perl6-examples/tree/master/shootout/&quot;&gt;shootout/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can contribute by sending pull requests, or better yet, join #perl6 on the Freenode IRC network and ask for a commit bit.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Have the appropriate amount of fun!&lt;/strong&gt;&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1164/&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/1164/&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=1164&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>gerdr</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 3 – Whatever the layout manager is</title>
		<link href="http://perl6advent.wordpress.com/2012/12/03/day-3-whatever-the-layout-manager-is/"/>
		<id>http://perl6advent.wordpress.com/?p=1123</id>
		<updated>2012-12-03T00:01:36+00:00</updated>
		<content type="html" xml:lang="en">&lt;h2 id=&quot;Introduction&quot;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This article aims to demonstrate how &lt;code&gt;Whatever&lt;/code&gt; — one of the many interesting Perl 6 curiosities — could be useful to easily implement and use complex things like a layout manager. In a couple of words, a layout manager is the part of a graphical interface in charge of the spatial arrangement of objects like windows or widgets. For the sake of simplicity, the layout manager implemented in this article will comply with the following three rules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;there are only two kinds of widgets: terminal or container, the latter can contain other widgets of either kind;
&lt;/li&gt;
&lt;li&gt;a widget cannot be overlapped, except for containers which fully contain their sub-widgets; and
&lt;/li&gt;
&lt;li&gt;only the height can be adjusted, this size can be either static, dynamic, or intentionally left unspecified.
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;Usage&quot;&gt;Usage&lt;/h2&gt;
&lt;p&gt;From the user's point-of-view, this layout manager aims to be as easy to use as possible. For example, it shouldn't be hard to specify such typical interface below, inspired from a text-based program. In this example, the &lt;i&gt;interface&lt;/i&gt; and &lt;i&gt;body&lt;/i&gt; widgets are containers, all the others are terminals:&lt;/p&gt;
&lt;pre&gt;interface (X lines)
+----&amp;gt; +------------------------------------------+
|      | menu bar (1 line)                        |  body (remaining space)
|      +------------------------------------------+ &amp;lt;----+
|      | subpart 1 (1/3 of the remaining space)   |      |
|      |                                          |      |
|      |                                          |      |
|      +------------------------------------------+      |
|      | subpart 2 (remaining space)              |      |
|      |                                          |      |
|      |                                          |      |
|      |                                          |      |
|      |                                          |      |
|      |                                          |      |
|      +------------------------------------------+ &amp;lt;----+
|      | status bar (1 line)                      |
+----&amp;gt; +------------------------------------------+&lt;/pre&gt;
&lt;p&gt;The user don't know what the &lt;i&gt;remaining space&lt;/i&gt; is in advance because such an interface is arbitrary resizable. As a consequence it should be specified as a non-predefined value; this is where &lt;code&gt;*&lt;/code&gt; — the &lt;code&gt;Whatever&lt;/code&gt; object — comes in handy. This object is interesting for two reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;from the user's point-of-view, the definition of non-static sizes is as simple as: &lt;code&gt;* / 3&lt;/code&gt; for the &lt;i&gt;subpart 1&lt;/i&gt; (dynamic) and just &lt;code&gt;*&lt;/code&gt; for the &lt;i&gt;subpart 2&lt;/i&gt; (unspecified); and
&lt;/li&gt;
&lt;li&gt;from the developer's point-of-view, Perl 6 transforms automatically things like &lt;code&gt;$size = * / 3&lt;/code&gt; into a closure: &lt;code&gt;x → x / 3&lt;/code&gt;. Then, it could be called like a regular function: &lt;code&gt;$size($x)&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That way, the previous GUI can be transliterated into the following lines of code:&lt;/p&gt;
&lt;pre&gt;my $interface =
    Widget.new(name =&amp;gt; 'interface', size =&amp;gt; $x, sub-widgets =&amp;gt; (
        Widget.new(name =&amp;gt; 'menu bar', size =&amp;gt; 1),
        Widget.new(name =&amp;gt; 'main part', size =&amp;gt; *, sub-widgets =&amp;gt; (
            Widget.new(name =&amp;gt; 'subpart 1', size =&amp;gt; * / 3),
            Widget.new(name =&amp;gt; 'subpart 2', size =&amp;gt; *))),
        Widget.new(name =&amp;gt; 'status bar', size =&amp;gt; 1)));&lt;/pre&gt;
&lt;h2 id=&quot;Implementation&quot;&gt;Implementation&lt;/h2&gt;
&lt;p&gt;The drawing of terminal widgets is straightforward since most of the work is done by containers. Those are in charge to compute the &lt;i&gt;remaining space&lt;/i&gt; as well as to uniformly distribute widgets that have an &lt;i&gt;unspecified&lt;/i&gt; size:&lt;/p&gt;
&lt;pre&gt;class Widget {
    has $.name;
    has $.size is rw;
    has Widget @.sub-widgets;

    method compute-layout($remaining-space? is copy, $unspecified-size? is copy) {
        $remaining-space //= $!size;

        if @!sub-widgets == 0 {  # Terminal
            my $computed-size = do given $!size {
                when Real     { $_                  };
                when Callable { .($remaining-space) };
                when Whatever { $unspecified-size   };
            }

            self.draw($computed-size);
        }
        else {  # Container
            my @static-sizes   =  grep Real,     @!sub-widgets».size;
            my @dynamic-sizes  =  grep Callable, @!sub-widgets».size;
            my $nb-unspecified = +grep Whatever, @!sub-widgets».size;

            $remaining-space -= [+] @static-sizes;

            $unspecified-size = ([-] $remaining-space, @dynamic-sizes».($remaining-space))
                                 / $nb-unspecified;

            .compute-layout($remaining-space, $unspecified-size) for @!sub-widgets;
        }
    }

    method draw(Real $size is copy) {
        &quot;+{'-' x 25}+&quot;.say;
        &quot;$!name ($size lines)&quot;.fmt(&quot;| %-23s |&quot;).say;
        &quot;|{' ' x 25}|&quot;.say while --$size &amp;gt; 0;
    }
}&lt;/pre&gt;
&lt;p&gt;Here, any &lt;code&gt;Callable&lt;/code&gt; object can be used to specify a dynamic size, as far as it takes the computed &lt;i&gt;remaining space&lt;/i&gt; as argument. That means it is possible to specify more sophisticated dynamic size by passing a code &lt;code&gt;Block&lt;/code&gt;. For example, &lt;code&gt;{ max(5, $^x / 3) }&lt;/code&gt; ensures the widget has a proportional size that can't decrease below &lt;code&gt;5&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;Conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;It's time to check if this trivial layout manager works correctly both in Rakudo and Niecza, the two most advanced implementations of Perl 6. The following test is rather simple, it creates and draws an interface, then resize it and draws it again:&lt;/p&gt;
&lt;pre&gt;my $interface =
    Widget.new(name =&amp;gt; 'interface', size =&amp;gt; 11, sub-widgets =&amp;gt; (
        Widget.new(name =&amp;gt; 'menu bar', size =&amp;gt; 1),
        Widget.new(name =&amp;gt; 'main part', size =&amp;gt; *, sub-widgets =&amp;gt; (
            Widget.new(name =&amp;gt; 'subpart 1', size =&amp;gt; * / 3),
            Widget.new(name =&amp;gt; 'subpart 2', size =&amp;gt; *))),
        Widget.new(name =&amp;gt; 'status bar', size =&amp;gt; 1)));

$interface.compute-layout;  # Draw
$interface.size += 3;       # Resize
$interface.compute-layout;  # Redraw&lt;/pre&gt;
&lt;p&gt;The results before and after resizing are respectively displayed below. They are close enough from the initial mockup, n'est-ce pas?&lt;/p&gt;
&lt;pre&gt;+-------------------------+            +-------------------------+
| menu bar (1 lines)      |            | menu bar (1 lines)      |
+-------------------------+            +-------------------------+
| subpart 1 (3 lines)     |            | subpart 1 (4 lines)     |
|                         |            |                         |
|                         |            |                         |
+-------------------------+            |                         |
| subpart 2 (6 lines)     |            +-------------------------+
|                         |            | subpart 2 (8 lines)     |
|                         |            |                         |
|                         |            |                         |
|                         |            |                         |
|                         |            |                         |
+-------------------------+            |                         |
| status bar (1 lines)    |            |                         |
                                       |                         |
                                       +-------------------------+
                                       | status bar (1 lines)    |&lt;/pre&gt;
&lt;p&gt;Finally, the implementation of such a &lt;i&gt;flexible&lt;/i&gt; program is really simple in Perl 6: everything is already there, in the core language. Obviously, this trivial layout manager isn't ready for prime-time since a lot of things are missing: sanity checks, multiple dimensions, … but those are left as exercises to you, the reader ;) For any questions or comments, feel free to meet Perl 6 fellows on IRC (#perl6 on freenode).&lt;/p&gt;
&lt;h2 id=&quot;Bonus&quot;&gt;Bonus&lt;/h2&gt;
&lt;p&gt;As seen previously, &lt;code&gt;$!size&lt;/code&gt; can be &lt;code&gt;Whatever&lt;/code&gt;, but it can't be &lt;i&gt;whatever&lt;/i&gt; you want. For example, a negative &lt;code&gt;Real&lt;/code&gt; or a string are not correct values. Once again Perl 6 provides a simple yet powerful feature: &lt;i&gt;constrained&lt;/i&gt; types. In a couple of words this permits to define new types from a set of constraints:&lt;/p&gt;
&lt;pre&gt;subset PosReal of Real where * &amp;gt;= 0;
subset Size where {   .does(PosReal)
                   or .does(Callable) and .signature ~~ :(PosReal --&amp;gt; PosReal)
                   or .does(Whatever) };

has Size $.size is rw;&lt;/pre&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1123/&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/1123/&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=1123&amp;amp;subd=perl6advent&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>Cédric</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 2 – Anonymous functions for great good</title>
		<link href="http://perl6advent.wordpress.com/2012/12/02/anonymous-functions-for-great-good/"/>
		<id>http://perl6advent.wordpress.com/?p=1143</id>
		<updated>2012-12-02T00:01:21+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Perl 6 has great support for functions. It packs function signatures full with awesome, and lets you have your cake and eat it a couple of times over with all the ways you can specify a function. You can specify parameter types, optional parameters, named parameters, and even those cool where clauses. If I didn’t know better, I’d suspect Perl 6 was compensating for some predecessor’s rather rudimentary handling of parameters. (&lt;em&gt;*cough*&lt;/em&gt; &lt;code&gt;@_&lt;/code&gt; &lt;em&gt;*cough*&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;Among all these other things, Perl 6 also allows you to define functions without naming them.&lt;/p&gt;
&lt;pre&gt;sub { say &quot;lol, I'm so anonymous!&quot; }&lt;/pre&gt;
&lt;p&gt;How is this useful? If you can’t name the function, you can’t call it, right? Wrong.&lt;/p&gt;
&lt;p&gt;You can store the function in a variable. Or return it from another function. Or pass it to another function. In fact, when you don’t name your function, the focus becomes much more what code you’re going to run &lt;em&gt;later&lt;/em&gt;. Like an executable “to do”-list.&lt;/p&gt;
&lt;p&gt;Of course, Perl 5 has anonymous functions, too. With exactly the same syntax, even. In fact, all the big languages do anonymous functions, according to &lt;a href=&quot;https://en.wikipedia.org/wiki/Anonymous_function#List_of_languages&quot; title=&quot;Anonymous functions, List of languages @ Wikipedia&quot;&gt;this list of languages&lt;/a&gt; on Wikipedia. Except, it seems, the historically significant languages C and Pascal. And the more modern but lumbering Java. “Planned for Java 8″. Haha, Java, catch up! Even C++ has them now.&lt;/p&gt;
&lt;p&gt;How important are anonymous functions? Very. In the 1930s, Alan Turing showed how all computer processes could be simulated using just a pre-programmed machine that looks like a tape recorder, reading and writing values on a really long tape. (The Turing Machine.) Meanwhile, across the Atlantic, Alonzo Church showed how all computer processes could be simulated using just &lt;em&gt;anonymous functions&lt;/em&gt;, no tape recorder required. (Lambda calculus.) It’s all quite elegant.&lt;/p&gt;
&lt;p&gt;Later languages like Lisp and Scheme lean heavily on anonymous functions as a key component in the language. And lately a scrappy language called JavaScript, which also leans heavily on anonymous functions, has taken over the world while we were all busy surfing the web.&lt;/p&gt;
&lt;p&gt;But let’s talk possibilities here. What can anonymous functions do for us? And how would it look in Perl 6?&lt;/p&gt;
&lt;p&gt;Well, take sorting as a famous example. You could imagine Perl 6 having a &lt;code&gt;sort_lexicographically&lt;/code&gt; function and a &lt;code&gt;sort_numerically&lt;/code&gt; function. But it doesn’t. It has a &lt;code&gt;sort&lt;/code&gt; function. When you want it to sort in a certain way, you just pass an anonymous function to it.&lt;/p&gt;
&lt;pre&gt;my @sorted_words = @words.sort({ ~$_ });
my @sorted_numbers = @numbers.sort({ +$_ });&lt;/pre&gt;
&lt;p&gt;(Technically, those are blocks, not functions. But the difference isn’t significant if you’re not planning to &lt;code&gt;return&lt;/code&gt; anywhere inside.)&lt;/p&gt;
&lt;p&gt;And of course it goes further than just those two sort orders. You could sort by shoe size, or maximum ground speed, or decreasing likelihood of spontaneous combustion. All because you can pass in any logic as an argument. Object-oriented people are very proud of this pattern, and call it “dependency injection”.&lt;/p&gt;
&lt;p&gt;Come to think of it, &lt;code&gt;map&lt;/code&gt; and &lt;code&gt;grep&lt;/code&gt; and &lt;code&gt;reduce&lt;/code&gt; all &lt;em&gt;depend&lt;/em&gt; on this kind of function-passing. We sometimes refer to passing functions to functions as “higher order programming”, as if it was only something people with special privileges should be doing. But in fact it’s a very useful and broadly applicable technique.&lt;/p&gt;
&lt;p&gt;The above examples all run the anonymous functions as part of their own execution. But there’s no need to restrict ourselves to this. We can create functions, return them, and then run them later:&lt;/p&gt;
&lt;pre&gt;sub make_surprise_for($name) {
    return sub { say &quot;Sur-priiise, $name!&quot; };
}

my $reveal_surprise = make_surprise_for(&quot;Finn&quot;);    # nothing happens, yet
# ...wait for it...
# ...wait...
# ...waaaaaaait...
$reveal_surprise();        # &quot;Sur-priiise, Finn!&quot;
&lt;/pre&gt;
&lt;p&gt;The function in &lt;code&gt;$reveal_surprise&lt;/code&gt; remembers the value of &lt;code&gt;$name&lt;/code&gt; even though the original function passing it in has exited long ago. That’s pretty nice. This effect is referred to as the anonymous function &lt;em&gt;closing over&lt;/em&gt; the variable &lt;code&gt;$name&lt;/code&gt;. But there’s no need to get technical — the long and short of it is “it’s awesome”.&lt;/p&gt;
&lt;p&gt;And in fact, it feels quite natural if we just look at anonymous functions alongside other staple storage mechanisms such as arrays and hashes. All of these can be stored in variables, passed as arguments or returned from functions. An anonymous array allows you to store a sequence of things for later. An anonymous hash allows you to store mappings/translations of things for later. An anonymous &lt;em&gt;function&lt;/em&gt; allows you to store &lt;em&gt;calculations&lt;/em&gt; or &lt;em&gt;behavior&lt;/em&gt; for later.&lt;/p&gt;
&lt;p&gt;Later this month, I’ll go through how to exploit dynamic scoping in Perl 6 to create nice DSL-y interfaces. We’ll see how anonymous functions come into play there as well.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1143/&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/1143/&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=1143&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">Perl 6 changes - 2012W48</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2012W48.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2012W48.html</id>
		<updated>2012-12-01T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Rakudo Star 2012.11 was released with new impressive improvements (check my previous posts for more information). If you’re reading this, please check out the &lt;a href=&quot;http://perl6advent.wordpress.com/&quot; title=&quot;Perl 6 Advent Calendar&quot;&gt;Perl 6 Advent Calendar&lt;/a&gt; - new posts are added daily.&lt;/p&gt; id='incompatible_changes'&amp;gt;Incompatible changes&amp;gt;&lt;h2 id=&quot;rakudo_star_post_rakudo_star_201211&quot;&gt;Rakudo Star (post Rakudo Star 2012.11)&amp;gt;&lt;ul&gt;
&lt;li&gt;Removed &lt;code&gt;~/.perl6/lib&lt;/code&gt; from &lt;code&gt;@*INC&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;/h2&gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Str.indent&lt;/code&gt; ignores empty lines.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl_in_rakudo_star_201211&quot;&gt;Rakudo Perl (in Rakudo Star 2012.11)&amp;gt;&lt;ul&gt;
&lt;li&gt;Unknown metacharacters in regexp throw &lt;code&gt;X::Syntax::Regex::UnrecognizedMetachar&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Null regexp throws &lt;code&gt;X::Syntax::Regex::NullRegex&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Unrecognized backslash sequence throws &lt;code&gt;X::Backslash::UnrecognizedSequence&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;Non-variable dollar throws &lt;code&gt;X::Backslash::NonVariableDollar&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl_post_rakudo_star_201211&quot;&gt;Rakudo Perl (post Rakudo Star 2012.11)&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--doc&lt;/code&gt; option now works.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;Str.indent&lt;/code&gt; ignores empty lines.&lt;/li&gt;

&lt;li&gt;Added &lt;code&gt;Signature.ACCEPTS&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;niecza_perl&quot;&gt;Niecza Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;make install&lt;/code&gt; now works.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en">Day 1 – State of Perl 6 in 2012</title>
		<link href="http://perl6advent.wordpress.com/2012/12/01/state-of-perl-6-in-2012/"/>
		<id>http://perl6advent.wordpress.com/?p=1109</id>
		<updated>2012-12-01T00:00:36+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Welcome to another edition of your annual Perl 6 advent calendar.&lt;/p&gt;
&lt;p&gt;As is tradition on the first of December, you can read a short overview over what has changed in the past year, and where we are standing now.&lt;/p&gt;
&lt;p&gt;The list of major changes to the specification is pretty short. The IO subsystem has undergone a rewrite, and now much better reflects the realities in implementations, and actually has a measure of common sense applied. &lt;a href=&quot;http://perlcabal.org/syn/S32/Exception.html&quot;&gt;S32::Exceptions&lt;/a&gt; has gone through lots of changes (mostly extensions), and now there is a decent core of exception classes in Perl 6.&lt;/p&gt;
&lt;p&gt;Both Rakudo and Niecza, the two major Perl 6 compilers, have matured a great deal. Contrary to last year, chances are pretty good that if your program works on one of the compilers, it also works on the other. Niecza also temporarily overtook Rakudo on the count of passing tests.&lt;/p&gt;
&lt;p&gt;Niecza had a revamp of the roles implementation, has gained constant folding, awesome Unicode support in regexes, list comprehensions and a &lt;code&gt;no strict;&lt;/code&gt; mode. To name just a few of the major changes.&lt;/p&gt;
&lt;p&gt;Rakudo now supports heredocs, all phasers (special blocks like BEGIN, END, FIRST, …), longest-token matching in regexes, typed exceptions, much nicer backtraces and operator adverbs. And it now has a debugger, which is shipped with the Rakudo Star distribution.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://modules.perl6.org/&quot;&gt;module ecosystem&lt;/a&gt; has grown a lot, and there is much more &lt;a href=&quot;http://doc.perl6.org/&quot;&gt;documentation&lt;/a&gt; for Perl 6 than a year ago.&lt;/p&gt;
&lt;p&gt;So, after all these changes, where are we now?&lt;/p&gt;
&lt;p&gt;Reports from production uses of Perl 6 are slowly starting to trickle in, and these days if your Perl 6 code has bugs, the chances are much higher that your code is to blame than the compilers. Perl 6 has never been this much fun to use. It surely has been a good and productive year for Perl 6, and we’re sure that this last month will continue the tradition. Have fun!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/perl6advent.wordpress.com/1109/&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/1109/&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=1109&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">-2 6</title>
		<link href="http://glitchmr.github.com/2-6.html"/>
		<id>http://glitchmr.github.com/2-6.html</id>
		<updated>2012-11-30T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;You know, -2 is highly connected to Perl 6. It’s valid syntax for &lt;code&gt;-(2)&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://encrypted.google.com/search?hl=en&amp;amp;q=%2D2%206&quot;&gt;&lt;img /&gt;&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</source>
	</entry>

	<entry>
		<title type="html" xml:lang="en-US">Rakudo Star 2012.11 released</title>
		<link href="http://rakudo.org/2012/11/28/rakudo-star-2012-11-released/"/>
		<id>http://rakudo.org/?p=231</id>
		<updated>2012-11-28T19:12:18+00:00</updated>
		<content type="html" xml:lang="en-US">&lt;p&gt;On behalf of the Rakudo and Perl 6 development teams, I’m happy to announce the November 2012 release of “Rakudo Star”, a useful and usable distribution of Perl 6.  The tarball for the November 2012 release is &lt;a href=&quot;http://github.com/rakudo/star/downloads&quot;&gt;available for download&lt;/a&gt;.  A Windows .MSI version of Rakudo star will usually appear in the downloads area shortly after the tarball release.&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 &lt;a href=&quot;https://github.com/rakudo/rakudo/blob/nom/docs/announce/2012.11&quot;&gt;release 2012.11&lt;/a&gt;of the &lt;a href=&quot;http://github.com/rakudo/rakudo&quot;&gt;Rakudo Perl 6 compiler&lt;/a&gt;, version 4.6.0 of the &lt;a href=&quot;http://parrot.org/&quot;&gt;Parrot Virtual Machine&lt;/a&gt;, and various modules, documentation, and other resources collected from the Perl 6 community.&lt;/p&gt;
&lt;p&gt;Some of the new features added to this release include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;heredocs&lt;/li&gt;
&lt;li&gt;quote adverbs (like q:w//)&lt;/li&gt;
&lt;li&gt;implemented precedence related traits (equiv, looser, tighter, assoc)&lt;/li&gt;
&lt;li&gt;Perl 6 grammar NFAs are pre-computed, saving some work on each  invocation; this shaved around 10% off the time needed to run the spectests&lt;/li&gt;
&lt;li&gt;regexes and quotes have better support for user-selected delimiters&lt;/li&gt;
&lt;li&gt;FIRST/NEXT/LAST can now be used in all types of loop (previously limited to for)&lt;/li&gt;
&lt;li&gt;several fixes related to module precompilation. This should make working with larger code bases much less painful.&lt;/li&gt;
&lt;p&gt;This release also contains a range of performance improvements, bug fixes, improvements to error reporting and better failure modes. &lt;/p&gt;
&lt;p&gt;The following features have been deprecated or modified from previous releases due to changes in the Perl 6 specification, and are being removed or changed as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; at present, a reference to an &amp;amp;foo that does not exist evalutes to Nil. This will become a CHECK-time failure, in line with STD.&lt;/li&gt;
&lt;li&gt;Unary hyper ops currently descend into nested arrays and hashes.  This will change to make them equivalent to a one-level map.&lt;/li&gt;
&lt;li&gt;~/.perl6/lib will go away from the default include path (@*INC).&lt;br /&gt;
  Instead %*CUSTOM_LIB now holds paths to four library locations:&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;perl    Rakudo installs its core modules here
vendor  OS-level package managers should install their modules here
site    for local module installations (e.g. with panda or ufo)
home    like site, but always under the user's home directory.
        fallback if site isn't writable.
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;The Str.ucfirst builtin is deprecated; it will be replaced by Str.tc.&lt;/li&gt;
&lt;li&gt; Leading whitespace in rules and under :sigspace will no longer be converted to &amp;lt;.ws&amp;gt; .  For existing regexes that expect this conversion, add a &amp;lt;?&amp;gt; in front of leading whitespace to make it meta again.&lt;/li&gt;
&lt;li&gt;The ?-quantifier on captures in regexes currently binds the capture  slot to a List containing either zero or one Match objects; i.e., it is equivalent to “** 0..1″.  In the future, the ?-quantifier will bind the slot directly to a captured Match or to Nil.  Existing code can manage the transition by changing existing ?-quantifiers to use “** 0..1″, which will continue to return a List of matches.&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;advanced 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;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 an online resource at http://perl6.org/compilers/features that lists the known implemented and missing features of Rakudo 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 .&lt;/p&gt;
&lt;p&gt;See http://perl6.org/ for links to much more information about Perl 6, including documentation, example code, tutorials, reference materials, specification documents, and other supporting resources.  A draft of a Perl 6 book is available as docs/UsingPerl6-draft.pdf 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 http://rakudo.org/how-to-help, ask on the perl6-compiler@perl.org mailing list, or join us on IRC #perl6 on freenode.&lt;/p&gt;&lt;/ul&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: Niecza Perl 6 v24 by Stefan O'Rear</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/11/msg689.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/11/msg689.html</id>
		<updated>2012-11-26T23:18:27+00:00</updated>
		<content type="html">&lt;br /&gt;    Announce: Niecza Perl 6 v24&lt;br /&gt;&lt;br /&gt;This is release number 24 of Niecza Perl 6, marking 24 months since the first&lt;br /&gt;public release.  How time flies.&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;&lt;br /&gt;[Bug fixes]&lt;br /&gt;&lt;br /&gt;.classify and .categorize now return hashes.  (Solomon Foster)&lt;br /&gt;&lt;br /&gt;qx// is now sandboxed.  (Solomon Foster)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Features]&lt;br /&gt;&lt;br /&gt;Added special functions gamma, expm1, log1p, erf, lgamma.  (Solomon Foster,&lt;br /&gt;using library code by John D. Cook)&lt;br /&gt;&lt;br /&gt;Export $*CUSTOM-LIB for panda's use.  (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Added Parcel.Array and List.Array.  (Solomon Foster)&lt;br /&gt;&lt;br /&gt;Postfix operaters which mimic methods can now be used.  (Larry Wall)&lt;br /&gt;&lt;br /&gt;Added functionality for a &quot;precompiled system modules&quot; folder, eliminating&lt;br /&gt;the need for each user to separately compile the setting in a multi-user&lt;br /&gt;install.&lt;br /&gt;&lt;br /&gt;Added line editing to the REPL.&lt;br /&gt;&lt;br /&gt;Added an install target for *nixes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[Internal]&lt;br /&gt;&lt;br /&gt;Niecza has been significantly refactored to use a single instance of the&lt;br /&gt;kernel during compilation, opening the door to direct object sharing&lt;br /&gt;between the compiler and the runtime and significantly simplifying the&lt;br /&gt;bootstrap procedure.&lt;br /&gt;&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.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[1] https://github.com/downloads/sorear/niecza/niecza-24.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-2013 perl.org</rights>
		</source>
	</entry>

	<entry>
		<title type="html">Perl 6 changes - 2012W47</title>
		<link href="http://glitchmr.github.com/perl-6-changes-2012W47.html"/>
		<id>http://glitchmr.github.com/perl-6-changes-2012W47.html</id>
		<updated>2012-11-24T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;So, well, now that my code compiles (well, C code, not Perl 6 code :-)) I’ve time to describe Perl 6 changes, instead of simply doing what &lt;a href=&quot;http://xkcd.com/303/&quot; title=&quot;XKCD: #303 - Compiling&quot;&gt;XKCD says&lt;/a&gt; - I shouldn’t waste time.&lt;/p&gt;&lt;p&gt;Rakudo Perl 2012.11 is now released. The change mentioned in this article is already in.&lt;/p&gt; id='new_features'&amp;gt;New features&amp;gt;&lt;h2 id=&quot;perl_6_specification&quot;&gt;Perl 6 specification&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NativeCall&lt;/code&gt; module is now part of specification.&lt;/li&gt;

&lt;li&gt;Calls to &lt;code&gt;trait_mod&lt;/code&gt; routines are evaluated in sink context.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;stdpm6&quot;&gt;STD.pm6&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--&amp;gt;&lt;/code&gt; (return type) acts more like a normal subroutine parameter.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;&lt;h2 id=&quot;rakudo_perl&quot;&gt;Rakudo Perl&amp;gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:($a, $b) := \(1, 2)&lt;/code&gt; updates &lt;code&gt;$a&lt;/code&gt; and &lt;code&gt;$b&lt;/code&gt; instead of doing nothing.&lt;/li&gt;
&lt;/ul&gt;&lt;/h2&gt;</content>
		<author>
			<name>Konrad Borowski</name>
			<email>glitchmr@myopera.com</email>
			<uri>http://glitchmr.github.com/</uri>
		</author>
		<source>
			<title type="html">π ** 6</title>
			<link rel="self" href="http://glitchmr.github.io/index.xml"/>
			<id>http://glitchmr.github.com/</id>
		</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-11-23T08:42:40+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">The Rakudo Codebase: Visualized! (Partially)</title>
		<link href="http://rdstar.wordpress.com/2012/11/22/the-rakudo-codebase-visualized-partially/"/>
		<id>http://rdstar.wordpress.com/?p=152</id>
		<updated>2012-11-22T08:59:05+00:00</updated>
		<content type="html" xml:lang="en">&lt;p&gt;Yesterday I stumbled upon &lt;a href=&quot;http://www.nntp.perl.org/group/perl.perl6.compiler/2009/09/msg4885.html&quot;&gt;this old perl6-compiler mailing list message&lt;/a&gt; which inspired me to actually try to split up the compilation of CORE.setting into smaller, saner pieces. &lt;a href=&quot;https://github.com/lue/rakudo&quot;&gt;I’ve started work on this already&lt;/a&gt; (so far having just modified the Makefile).&lt;/p&gt;
&lt;p&gt;The one and only response to that post suggested using the stub syntax to resolve missing class issues. Sadly, that does not work, because perl6 needs to see the stubbed class in full sometime later in the file.&lt;/p&gt;
&lt;p&gt;So, the best option I’ve seen is to include the files containing needed classes and roles into files that need them (through either use or require). This requires knowing what to include (as including everything everywhere ruins the point), and I’ve started to try to grasp what’s going on in the rakudo codebase, specifically src/core, in terms of dependencies.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/lue/rakudo-analyze&quot;&gt;Here’s what I have so far.&lt;/a&gt; It’s right now just one, single script. This single script graphs the inheritance chain of all the classes and roles in src/core (what classes and roles “is” and “does”). You need the modules Term::ANSIColor, Term::ProgressBar, and IO::Capture::Simple (at this time pulled in, but apparently unused, by Term::ProgressBar). You also need &lt;a href=&quot;http://betterthangrep.com/&quot;&gt;ack&lt;/a&gt; and &lt;a href=&quot;http://graphviz.org/&quot;&gt;graphviz&lt;/a&gt; (which is not used in the script, but needed to process the resulting core.dot file).&lt;/p&gt;
&lt;p&gt;Wanna see the graph for nom commit bf472b0, the latest as of this writing? Here you go (click to embiggen, clearly):&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://rdstar.files.wordpress.com/2012/11/core.png&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;alignnone size-medium wp-image-154&quot; height=&quot;5&quot; src=&quot;http://rdstar.files.wordpress.com/2012/11/core.png?w=300&amp;amp;h=5&quot; title=&quot;core&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The arrows point towards what a particular box is inheriting, and the one or two white boxes mean that the class or role doesn’t exist within the src/core files. Yellow denotes classes, red denotes roles. And each box contains the name of the class/role, and the file it was found in and the line number of its definition.&lt;/p&gt;
&lt;p&gt;This, however, doesn’t even begin to deal with all the dependencies abound in the src/core files. See all those abandoned colored blocks? Those aren’t inherited by anything in src/core, but they most certainly are utilized (e.g. the Pod::Config block, though not inherited, could easily be utilized as a variable type in the Pod code). I have a lot more work to do before I have a clear picture on how to separate CORE.setting into smaller pieces. (I might even need to utilize STD.pm6 or similar to do all the parsing I’ll eventually be doing!)&lt;/p&gt;
&lt;p&gt;Just to finish off, Here are a couple more graphs of the same data. The first graph above was generated with GraphViz’s “dot”. This one (generated by their “twopi” program) I think looks hilarious:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://rdstar.files.wordpress.com/2012/11/core_twopi.png&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;alignnone size-medium wp-image-156&quot; height=&quot;265&quot; src=&quot;http://rdstar.files.wordpress.com/2012/11/core_twopi.png?w=300&amp;amp;h=265&quot; title=&quot;core_twopi&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And this picture was generated by GraphViz’s “fdp”. I think this one is the easiest to follow.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://rdstar.files.wordpress.com/2012/11/core_fdp.png&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;alignnone size-medium wp-image-157&quot; height=&quot;300&quot; src=&quot;http://rdstar.files.wordpress.com/2012/11/core_fdp.png?w=258&amp;amp;h=300&quot; title=&quot;core_fdp&quot; width=&quot;258&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Happy viewing!&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/rdstar.wordpress.com/152/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/rdstar.wordpress.com/152/&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=rdstar.wordpress.com&amp;amp;blog=13482955&amp;amp;post=152&amp;amp;subd=rdstar&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>lueinc</name>
			<uri>http://rdstar.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Rakudo Death Star</title>
			<subtitle type="html">The slightly offtopic, laser-equipped space station of Perl 6</subtitle>
			<link rel="self" href="http://rdstar.wordpress.com/feed/"/>
			<id>http://rdstar.wordpress.com</id>
		</source>
	</entry>

	<entry>
		<title type="html">Parrot 4.10.0 &quot;Red-eared Parakeet&quot; Released by Reini Urban</title>
		<link href="http://www.nntp.perl.org/group/perl.perl6.announce/2012/11/msg688.html"/>
		<id>http://www.nntp.perl.org/group/perl.perl6.announce/2012/11/msg688.html</id>
		<updated>2012-11-21T17:27:35+00:00</updated>
		<content type="html">On behalf of the Parrot team, I'm proud to announce Parrot 4.10.0, also known&lt;br /&gt;as &quot;Red-eared Parakeet&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.10.0 is available on Parrot's FTP site&lt;br /&gt;(ftp://ftp.parrot.org/pub/parrot/releases/devel/4.10.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.10.0 News:&lt;br /&gt;    - Core&lt;br /&gt;        + Add PMCNULL check to result_info op&lt;br /&gt;        + Fixed record separator bug on io handles&lt;br /&gt;    - Build&lt;br /&gt;        + Add -fpermissive so that nqp builds under gcc 4.7.2&lt;br /&gt;        + Fixed warnings for old ICU 4.4&lt;br /&gt;    - Platforms&lt;br /&gt;        + More VMS fixes, but not yet done&lt;br /&gt;    - Branches&lt;br /&gt;        + The threads branch is ready to be merged, but nqp needs some changes,&lt;br /&gt;          so it will be merged with 4.11.0.&lt;br /&gt;    - Examples&lt;br /&gt;        + Parrot mini-web server fixes&lt;br /&gt;&lt;br /&gt;The SHA256 message digests for the downloadable tarballs are:&lt;br /&gt;82f38e6e596ab101c52313ad3e3560d2c8a72985362b54d9898619ab17a6f17d&lt;br /&gt;parrot-4.10.0.tar.gz&lt;br /&gt;7d6a592c386d25bcee429a269cc571ae81c5c080b15d14a884401a27fe3f5d4b&lt;br /&gt;parrot-4.10.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 18 December 2012.&lt;br /&gt;&lt;br /&gt;The release is a day late. I apologize for the lateness.&lt;br /&gt;--&lt;br /&gt;Reini Urban&lt;br /&gt;http://cpanel.net/   http://www.perl-compiler.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-2013 perl.org</rights>
		</source>
	</entry>

</feed>
