Following eric256's suggestion, I'm adding the current revision number as part of the journal title. He also would like to reply to my journal with code examples and pick up things I missed; I think that's a great idea, and all lambdacamel are welcome to join the fun.
:-)
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
Type :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]
* Path to the JavaScript output: output.html [OK]
jspugs> :h
Commands available from the prompt:
:h = show this help message
:q = quit
:conf thing [new_value] = set the path to thing
(pugs|pil2js|preludepc|lib6|output)
: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
jspugs> :precomp
# ../../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
* Path to the JavaScript output: output.html [OK]
Neat, no? The output.html
contains a link to <script type="text/javascript" src="preludepc.js"></script>
. Because the Javascript prelude is shared, code generation is quite fast now. Errors in the code generator are annotated with line/column info, thanks to the source ranges information preserved in PIL.
There is no JSAN support yet, but I suspect that one day we may compile use jsan:Form::Validator;
and unite with the rhinocamel world.
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:
class A;
class B is A; class C is A;
class BB is B; class CC is C;
class Z is BB is CC;
The call to
Z.new.method
should 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
A
happend
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 &is_deeply
in Test.pm
by simply compare their .perl
serializations. Clever.
Aankhen fixed &uri_escape
in URI::Escape
, and reported that printf
did not handle upper-case variants of format codes, such as %X
. putter fixed that promptly in Prelude.pm
.
fglock refactored the infinite recurrence set structure from Span::Code
into Recurrence.pm
.
putter added 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. :-)
Recent Comments