Today iblech introduced a jspugs.pl, a nice shell for Perl6/JS development. Here is a screenshot:
% cd perl5/PIL2JS/
Welcome to JSPugs -- Perl6 User's Golfing System
:h for help.
* Path to pugs: ../../pugs [OK]
* Path to pil2js: ./pil2js.pl [OK]
* Path to the precompiled Prelude: preludepc.js [NOT FOUND]
* Path to PIL2JS's lib6/: lib6 [OK]
Commands available from the prompt:
:h = show this help message
:q = quit
:conf thing [new_value] = set the path to thing
:precomp = precompile the Prelude
:pil <exp> = show PIL of expression
:pil.yaml <exp> = show PIL of expression dumped as YAML
<exp> = compile expression and save as HTML
:js <exp> = compile expression and show it
:l filename.p6 = compile file and save as HTML
../../pugs -Ilib6 -CPIL -MPrelude::JS -e ''
./pil2js.pl --no-jsprelude > preludepc.js
* Path to the precompiled Prelude: preludepc.js [OK]
jspugs> say "Hello, JSPugs!"
../../pugs -Ilib6 -CPIL -e say "Hello, JSPugs!"
./pil2js.pl --html --preludepc preludepc.js > output.html
Neat, no? The
output.html contains a link to
In order to get tests passing and
mandel.p6 to run, iblech fixed many corner cases in
Pugs.Compile, including invocant handling, delayed evaluation and prettyprinting, with helpful feedback from Arathorn and other #perl6 people. Already there is talks about generating SWF/ActionScript and PDF/ECMAScript in addition to HTML output...
iblech also added YAML serialization for PIL structures. It is purely positional and not as concise as I'd like, so I talked with him and putter about how the redesigned PIL should be serialized. The consensus seems to favor a YAML-style model, with all nodes carrying a type, and with a payload of a scalar, a list of nodes, or a hash of named subnodes. For example,
pugs -P YAML example.p6 would dump the PIL structure of
example.p6 as YAML nodes.
On the MetaModel front, Stevan implemented the C3 Method Resolution Order for multiple-inherited objects. I like C3 a lot, and I agree with Stevan that it should be made into the default Perl 6 method dispatch order. The core idea is that, in a diamond inheritance tree:
The call toclass A;
class B is A; class C is A;
class BB is B; class CC is C;
class Z is BB is CC;
Z.new.methodshould look up in the order of
Z, BB, B, CC, C, A, instead of (as in Perl 5)
Z, BB, B, A, CC, C; the latter dispatches to
Ahappend before its subclass
C-- this is part of the reason I considered multiple inheritance as insane. C3 restores much sanity here.
mugwump added a trivial implementation of
Test.pm by simply compare their
.perl serializations. Clever.
URI::Escape, and reported that
printf did not handle upper-case variants of format codes, such as
%X. putter fixed that promptly in
fglock refactored the infinite recurrence set structure from
Pugs::Internals::rule_pattern to extract the rule string out from an rule object, for his plan of writing a Rule parser in Perl 6. He worked some more on the Perl 6 Rules Grammar, but sadly PGE can't handle it yet.
Zero commits from me today to Pugs, as I'm still in paper-reading and discussion mode. I'm also picking up more $work for post-sabbatical livelihood, until I can find some sort of sponsorship for Pugs; in any case, I will try to keep about 3 days a week for Pugs. No promises, though -- as usual, all I can promise is a committer bit.