KindaPerl6- memory management: BEGIN-block side effects are logged- updated plan, discussed a possible release schedule- fixed the container proxy algorithm (the implementation needs to be fixed; pugs has the same problem)

2006.10.08

A revamped Guide to Perl 5 Embedding is now available. It provides details on how to pass the most common data structures to Perl 5, including arrays and arrayrefs, hashes and hashrefs, strings, and even code references.

Examples of using Perl 5 OO from Perl 6 are also provided. Some related bugs have also been fixed recently in Pugs.

Perl 5 embedding allows you create a project in Perl 6, while still using Perl 5 for parts that have not yet been ported to Perl 6. Updated Perl 5 Embedding is just one of the many updates that will be available in the next release of pugs, expected soon.

ok(!defined($foo3), "block enclosed by parentheses should not auto-execute (1)", :todo<bug>);

Note that TODO tests are marked as passing only if they're actually passing
(i.e., unexpected passing from the perspective of implementers) and they're marked
as failing only if they're actually failing (i.e. expected failing). I don't
introduce special marks for these tests because added complexity will lead to unnecessary
confusion.

Skipped tests have no marks at all and the intention is straightforward. Just don't mistake
blank tests for smartlinks.pl's bugs or something like that. ;)

There's also brief stats info in the link name so that you can see how many sub-tests are failing
and how many are not without actually expanding the code snippet. (Thanks Juerd++ for
suggesting this one.)
For instance:

where the revision number for pugs is extracted from the corresponding smoker's
report. Christopher has ensured the version of the Pugs test suite used by the smoke server
matches exactly the smoker's local Pugs. The timestamp was
proposed by Juerd while
the revision numbers for both syn and pugs were
proposed by [particle]++.

All the Synopses on the smoke server are updated periodically by cron, even including
old smoke reports that had been processed. We're trying to offer you the latest Perl 6 Spec
everywhere. :)

For more details on the original motivation and Christopher's design decisions,
please read the p6c threads below:

Thanks Gaal and Larry's tests.yml while I was implementing smoke result rendering feature in
smartlinks.pl many weeks ago. At last but not least, I really appreciate Christopher's
work on the smoke server/client mechanism to make this feature truly useful.
(We don't need auto-smoking
on feather any more, whee!) And I also thank iblech++ (yes, iblech's alive!) for helping
Christopher through the whole process.

The Synopses on feather will still go without smoke results,
since smoke results are always specific to a certain Perl 6 implementation or a Pugs backend.
We hope you will still like it. :)

Audrey once said on #perl6 that she was biased to fix tests with smartlinks. And [particle] recently said that he had started a port of smartlinks.pl to PIR so as to cross-reference PGE's tests with the Synopses and parrot PDDs. Furthermore, I've seen more and more people are adding both tests and smartlinks to the Pugs test suite, which is really really wonderful. :D

2006.09.04

Conrad Schneiker recently gave the Perl 6 community a gift by loading this new Perl 6 wiki full of content. The wiki itself runs SocialText software written in Perl 5 and hits a nice sweet spot between being featureful and easy to use. I recommend trying it out, and plan to use it frequently myself.

This wiki is still young, and as Andy Lester notes in the comment at the bottom, it would be useful to break up the front page content into several pages. It's a wiki, so feel free to jump in and help with that!

Update: I went through and overhauled the front page and site structure myself, so the front page is simple new, with some embedded Perl 6 news. Of course, it's a wiki, so you can further refine it as you like.

2006.09.02

Perl6 now has a notably improved entry point to find documentation. See the Official Perl 6 Documentation page. The center piece are the Synopsis documents, which form the specification for the language. A number of additional useful documents are now linked from here as well.

I'm personally been working on Perl6::Perl5::Differences, documenting things that seem like key differences as I learn the new language. Both pages are available in the pugs repository for anyone to improve.

In the process of this documentation work, I discovered there is already quit a lot of Perl6 information out there, but it's a bit fractured-- there's more to be done to create an excellent, sustainable central resource. I'm interested to experiment more with this new Perl6 wiki powered by SocialText. There's little information there now, but it looks especially friendly to use and work with.

2006.08.22

Search for links with names like "Show the snippet from ..." and click on them to find out the magical effect.
:)

Well,
in short,
we have divided the .t files in the Pugs test suite into pieces and inserted every resulting snippet after the corresponding paragraph of the Synopses.

The job was done by the Perl 5 script util/smartlinks.pl living in the Pugs source tree.
And all the *.html under http://perlcabal.org/syn/ are updated every hour with the latest Synopses and Pugs test suite.
Thanks to the cron program on feather.
;-)

At this point,
there is a hitch.
How does smartlinks.pl manage to determine which snippet of the tests corresponds to which paragraph of a certain synopsis?

Hmm,
I'm sure you may have already found the answer from the web pages.
There're hundreds of "smartlinks" spreading over the whole test suite in the form of comments.
Here're two examples:

# L<S04/The do-once loop/"can't" put while modifier>

# L<S04/"Switch statements" /"is exactly equivalent to">

You see, the "smartlink" has its deep root in our POD, but contains an extra "keyphrase" list after the second slash. This list of key phrases specifies which paragraph in the given section is relevant to the tests right below the comment.

Providing more sample code to the Synopses

Synopses are known for their rich samples. Unfortunately, the sample code in our Synopses is inadequate. Many sections go without sample code.

On the other hand, the Pugs test suite contains tens of thousands of tests, which can certainly serve as very good examples as long as they are correct and up-to-date.

Intuitive estimation for the quality of the tests

When we browse the web pages with test snippet embedded, it's quite easy to figure out the validity and also the integrity of the test suite.

For instance, if a whole section has no snippet links at all, then that probably means we need to add more tests as well as smartlinks. The HTML pages are good visual coverage reports per se.

Furthermore, the correctness of a group of tests is easiest to determine if it appears right in the context of the synopses.

Currently we also have TODO and SKIP marks in the test suite. Hence a good estimation of the proportion of the Synopses implemented by Pugs at a quick glance.

Easier to detect mismatch between tests and docs

Everyone can see from p6l that the Synopses are changing pretty fast. In contrast, many tests in the Pugs test suite are terribly out of date even though Larry has the habit of updating some tests after updating the documents.

But if we have enough smartlinks distributed in the test suite, the mismatch between tests and docs can be detected in the form of "broken" links. To get a list of broken links, we only need a single command:

$ util/smartlinks.pl --check t/*/*.t t/*/*/*.t

Unmatched smartlinks (if any) will be reported in detail:

ERROR: t/operators/quoting.t: line 173: pattern ``/Split result on words (no quote protection)/'' failed to match any paragraph in L<S02/Literals>.

ERROR: t/data_types/arglist.t: line 6: section ``Operator renaming'' not found in S03.

As I have told Juerd on #perl6, the original goal of developing smartlinks.pl is simply to make myself more motivated to contribute tests to Pugs.

Thanks to other Pugs contributors who have been working strenuously on the smartlinks long before I joined the Pugs team. Without their work, smartlinks.pl won't produce anything meaningful today. :)

Update:

We now use the term "keyphrase" instead of "keywords" since the order of the keys is significant. Thank TimToady++ for proposing this cool name. :)

2006.07.26

Yay, merlyn++'s wonderful article is now available online! I attended his and bdfoy++'s "Learning Perl 6" course at YAPC::NA, and I'm really amazed of their ability to explain concepts so effectively.

Also, the instructor point-of-view is helpful to language design as well: For example, merlyn++ noted that the ==> and <== operators, known as the pipe operators, is likely to cause confusion with Unix pipes. Because they are shipping concrete objects instead of stream-of-characters, now they are renamed feed operators.

Another example: The implicitly-passed-with-each-calls variables were known as environmental variables, and declared with "env $x". However, merlyn++ noted that it can easily be confused with environment variables in %*ENV. So they are now contextual variables, and declared with "my $x is context".

2006.04.23

The past three days weren't all about license; live design sessions on #perl6 happens every day for hours, resolving the remaining ambiguities that slows down Perl 6 parsing (due to ambiguities that requires infinite lookahead), or the parts that were easy in Parsec but was difficult to declare as Rules.

Because of this, Perl 6 always require a whitespace before < to denote an infix operator; non-whitespaces always means the postcircumfix <> macro, which then desugars to a postcircumfix {} lookup.

Pugs currently uses very expensive backtracking to disambiguate these cases, so getting rid of them should dramatically reduce parsing time.

While switching to Packrat Parsing
(gaal++ for the pointer) would allow infinite lookahead and backtracking
with linear time, it doesn't make it easier for humans to disambiguate
between the two cases above -- so we are not doing that. Instead, I'm using Christopher Kuklewicz's excellent Text.Regex.Lazy package, a compiler that turns extended regexes with customized backtracking strategies (read: Perl 6 rules) into Parsec functions.

This should allow for piecemeal migration from Pugs's Parsec parser to a grammar fully defined in Perl 6 rules syntax, and allow maximum sharing with pmichaud and fglock's parsers.

So, while I only checked in about 15 changes to Pugs this week, there were more than 20 commits to the Synopses, from TimToady, pmichaud and yours truly. Among the changes where:

Backtracking patterns are now constructed by its old name, regex, instead of rules, which never backtracks. The variant of rules that does not translate /a b/ to /a<ws>b/ but to /ab/ is called tokens. Damian++.

The *$foo and **$foo syntax now always means "inject content of $foo into the current argument list", and has nothing to do with list contexts anymore.

A new form :!foo to mean the counterpart of :foo, namely a pair with foo as key and false as value.

There is no native str type anymore; it's now always buf, so the confusions of Perl 5's buffer->string autopromotion will not appear. See my encoding::warnings for an explanation of the misdesign -- Dan Kogan and I both thinks that's the #1 Bad Idea of the Perl 5 string model, and I'm glad it's gone from Perl 6 now. (That also means Str are also immutable and Buf are always mutable -- think of the latter as Byte Arrays.)

2006.04.17

Thanks to all the feedback to yesterday's Capture.pod post, today I updated Capture.pod with more examples, including a more elaborate description on single/multiple vs subroutine/method dispatch (as requested by Humberrto), which I reproduce below:

What about multi-dispatch?

Multi-dispatch governs cases where multiple subroutines or methods share the same name, relying on the arity and types of tie-breaking parameters
in their parameter list (Signature):

During multi-dispatch, a tie-breaking parameter may bind to the invocant
argument (e.g. for multi-methods), or one of the positional arguments.

However, regardless of single- or multi- dispatch, the argument list (Capture)
can never have more than one invocants. Typically, the presence of an invocant
indicates a method-call (which may fall back to a subroutine-call); the lack of
invocant means a subroutine-call.

1.foo(2); # Int.foo with 1 as "self"; if not found, # then fall back to foo(1, 2) foo(1: 2); # same as above

Method/subroutine calls are determined by the presence of an invocant at the
calling site. Single/multi dispatch are determined by the presence of multi
in the declaration site. The two concepts are entirely orthogonal.

The last line was key -- it took me several months to realize that in the Synopses, the so-called "invocant parameters" in multisubs really have nothing to do to with "invocant arguments" in method calls. Hence I've started referring to them as "tiebreaking parameters" to reduce general confusion.

Also, instead of mixing multi and method with the MMD acronym, I've taken to say sub/methodcalls and single/multidispatch, to further clarify that they are distinct (and quite unrelated) concepts. Hope that helps...

I'll have less cycles to stay on #perl6 the next four days, as all three projects at $job are drawing into their closure, and I'd like to deliver them properly before going back to Pugs. However, we are just 35 commits away from r10000, and it might make a nice birthday gift to myself... So we'll see if I manage to send in some commits here and there. :-)