Another nice week with Web.pm. They usually start out slow, as if to give me some breathing-room after writing the previous week's summary, and then they just tend to take off, with more and more leads to follow. Furthermore, this increase seems to become stronger each week — a kind of meta-increase, if you will.

My Saturday build-a-blog-in-90-minutes spree inspired Tene++ to do the same, except he did it in 20 minutes, and his source code looks much cooler than mine. Besides using his module Tags, which I also used, he also effortlessly does dispatching with his amazing 16-line module LolDispatch. It uses a feature in Rakudo called "trait handlers", which I wasn't even aware existed before I saw it in Tene's code.

Apart from LolDispatch and Ilya's Routes, there's now also a new dispatcher called Faz. This one was created by ruoso++, and it works by registering the URL regexes that participate in the dispatch, and compiling them into one unit which then handles all the request URLs. After writing this dispatcher, ruoso also ported my quick-and-dirty blog engine. Here's the ported blog engine, and here's the dispatcher. Go look at it, it's cool stuff.

It feels kinda nice to have a short public programming session of mine cause two people to independently turn my unworthy code into two different kinds of great, and this within the course of three days. Clearly, I should do more of these slightly insane coding marathons.

(Oh, and the eventual goal is to be able to do a blog engine in 3 to 5 minutes on Web.pm. But I think we'll need our Rails/Catalyst idea to be able to pull that off.)

Yesterday, viklund and I had a hackathon — the first Tuesday in quite some time when we were both available. Since those Tuesday hacking sessions are really meant for Novermber work but my head was full of Web.pm stuff, we compromised and started experimenting with the Hitomi prototype, which will hopefully be suitable for November some day. The reason I still consider Hitomi being stuck in prototype mode is that none of us have yet managed to build both the bottom-up parser (using grammar actions) and the top-down parser (that does the actual template substitutions), and have these play nicely together.

But in yesterday's pair programming session, we made some real progress in a number of ways. I finally grokked the make call. (It's not that hard, really. It just sets the.ast property on the Match object to whatever you pass it.) We actually got a pl:if directive to behave as we wanted, that is we got it to appear and disappear based on the truth value of an expression. After I reluctantly left, viklund kept hacking on the proof-of-concept. As I write this, he's still at it: here's the latest version. viklund++

I realized, when explaining Hitomi to viklund, that I haven't really (apart from some semi-coherent IRC ramblings) taken the time to output the part of its design that I've nailed down so far into a substrate outside of my brain. So here's a short summary: templates contain value substitutions, if-directives and for-loops. Value substitutions look like this right now in Hitomi: ${ $value }. They can occur in the content between tags, and as part of attribute values. If directives are simply elements with a pl:if attribute. The value of that attribute is evaluated as a Perl 6 expression, and the boolified result determines whether to serialize the whole element in question. For loops, correspondingly, are elements with pl:for attributes. The value of those attributes are also expressions, often evaluating to lists, which are then looped over. But there's a twist: you can also have the attribute value contain something like "@list -> $elem", and (just as in Perl 6 for-loops) the variable $elem will be magically available within the children of that element node. (Бог knows how we'll implement that last part, but the idea just feels too good to leave out.)

At present, all the evaluations are done in the application itself, not because we like it that way, but because we're trying to get something to work. I plan to do a second dive into Genshi and see how they do the whole evaluation thing. Intuitively, working on some kind of data object which holds results from a database call seems much saner.

Finally, today there was a short discussion about Web.pm on #perl6. Among other things, we concluded that Web.pm aims to be server-engine-agnostic, but that it isn't really at this point. In fact, more and more examples are being created where mberends++' HTTP::Daemon is assumed to be the only web server in the world. (Partly because, at this point, it kinda is.) Anyway, I feel an obligation to port some more of Rack to at least make it possible to code web applications in as agnostic a way as possible. I will revisit the Rack design and source code in the coming weeks.

All in all, a lot is happening, and my weekly agenda is starting to write itself to some extent. People are actually coming up to me on IRC and asking about Web.pm, which is both exhilirating and a bit scary. Need to fix all those things that don't work yet...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.