Skip to main content.

Archives

This is the archive for October 2007

Monday, October 22, 2007

Apache API (the system abstraction layer APR and the HTTPD "AP") are one of the most amazing APIs around. Powerful, neat, little, flexible and straight to the point. Making an Apache module would be great fun...

...if they ever bother writing an high-context documentation. There's no way to have the "big picture", a plan of what to do to achieve what you want, written down on documents. What is around is either outdated (and not being removed or marked as such is confusing the reader by providing him a context information that is not anymore valid), or focusing on particular aspects, as writing "filters", or the fun of using memory pools.

For that reason alone, putting down "due righe messe in croce" (two lines put down in a cross, as we say in Italy) took me one full day plus about a couple of day in hunting documentation. IMHO Apache is the big Open Source project having the worst documentation around, especially when it comes to the API.

I understand that they live on consulting and selling books, but sharing some enlightenment with us would be appreciated...

Tuesday, October 16, 2007

Two weeks. I wasted two weeks in doing the code for FTD (falcon template document). In the beginning, thinking the way PHP files are organized, I thought of doing a cute meta compiler, or upper level compiler, that would have then selected the proper compiler (falcon source or ftd file) and extracted a module from that. The ftd compiler itself would have created small pieces of codes (the things in escapes) and fed them to a properly configured source compiler, which would have integrated the source tree being formed with the code parsed in the way. Of course, this wouldn't have allowed leaving instructions half-way through, (i.e. doing part of a function in an escape, returning to document and re-escaping to continue the function), but that was ok to me.

Of course, that was quite clumsy and inefficient, but that was ok to me too, as the point was to have a fam module ready and use that instead, rather than compiling each time the source.

The real problem arose when I tried to create some block statement which could use unescaped sections, (the thing done with blocks in php). As falcon compiler is context sensible, that meant redesign the compiler so that "end" was considered a statement on its own, being able to close autonomously the currently open context. That worked for the simpler cases, but doing something decent with context sensible code, (i.e. class and object declarations) was nearly madness.

While thinking at something completely different (for the chronicle: I was composing a tune) I zenned it. I had been thinking the wrong way; I didn't have to virtualize the compiler, but to extend its working principles. I thought top-bottom, but here the solution was bottom-top.

In fact, modules created from ftd files are just normal modules where the unescaped blocks are automatically echoed to the VM through the ">" (fast print operator). All that I had to do was to provide the LEXER with an extra "mode", where it would have returned a fast-print related token for unescaped blocks, entering the normal mode after an escape, and then returning to "outer" mode when the escape was closed.

This took two hours coding, less than 200 new lines around, and worked like charm enabling ftd documents to seamlessly merge escaped and unescaped code. Even more than what I was dreaming for in the beginning...

Alas, the experiment with de-contextualized "end" statement wasn't fruitless: in the effort of doing it right I redesigned the lambda functions, separating lambda expressions from nameless functions. That's a change worth to be taken in the main branch, as it simplifies and makes much more natural one of the still controversial grammar issues.

In my defense, I have to admit that I had been ill last two-three weeks, having contracted a strange flu which was quite widespread in Italy and that didn't bear the usual symptoms, but caused muscular pain and loss of concentration.

Monday, October 08, 2007

"I'll write in Italian" from now on.

I've been waiting for a long time before to take this decision. I wished I could just use this blog to stored my thing and to share them with the world. For that I had to use English, despite the fact that I know I am not very skilful in that language. But things in Italy are taking a turn that I can't stand anymore, and I feel the urge to write about them.

From now on I will be mainly writing in Italian in a "parallel blog" whose address will be http://sveglia.niccolai.cc.

It should be active in hours. I cannot move very much in term of "space", but I hope I can contribute making my country a better place with the things I say, and the world a better place by contributing in seting up a country which works for world wealth and freedom, rather for hegemony and interest.