From: Lucian Mogosanu Date: Mon, 9 Sep 2019 06:58:49 +0000 (+0300) Subject: Add draft for cl-www summary X-Git-Url: https://git.mogosanu.ro/?a=commitdiff_plain;h=9301bc297ed17cba55aece547551f821a9587a4e;p=thetarpit.git Add draft for cl-www summary --- diff --git a/drafts/000-cl-www-summary.markdown b/drafts/000-cl-www-summary.markdown new file mode 100644 index 0000000..6a779a4 --- /dev/null +++ b/drafts/000-cl-www-summary.markdown @@ -0,0 +1,184 @@ +--- +postid: 000 +title: Common Lisp WWWism summary +date: October 1, 2019 +author: Lucian Mogoșanu +tags: tmsr, tech +--- + +This post is part of a series on [Common Lisp WWWism][cl-www], more +specifically a summary of what's been discussed so far and some +conclusions. Maybe there isn't much to be said about these "summary" +posts, but at least in this particular case I believe a synthetic view +of what's been said so far oughta clear up future decisions on the +subject. Oh, and this will be my last post on this, for a while at +least. + +Let's begin by outright enumerating everything I've written so far on +CL WWWistics: + +* [CL-WHO genesis][cl-who-i] +* [A review of Hunchentoot's code history][hunchentoot-history] +* [CL-WHO demo: The Coad Pit][cl-who-ii] +* [Notes on Hunchentoot architecture][hunchentoot-ii] +* [Hunchentoot: further architectural notes; and usage examples][hunchentoot-iii] +* [Hunchentoot: acceptor code review][hunchentoot-iv] +* [Hunchentoot: taskmaster code review][hunchentoot-v] +* [Hunchentoot: requests and replies [a]][hunchentoot-via] +* [Hunchentoot: requests and replies [b]][hunchentoot-vib] +* [Hunchentoot genesis][hunchentoot-genesis] + +There's also [tons][logz-hunchen] of [lines][logz-cl-who] in the logs +about all this, you're more than welcome to dig them out and let them +enlighten you on the matter. + +Notice that there's about a couple of items discussed in all these blog +posts: the HTML generation language known as CL-WHO and the Hunchentoot +web server. Together they form something very similar to Apache and PHP, +although CL-WHO isn't a PHP, while Hunchentoot isn't *exactly* an +Apache. + +More precisely, Hunchentoot is a sort of proto-Apache along with a sort +of mod\_lisp, in that it provides [the basic tools][logz-1934007] one +needs to make a dynamic web site: the TCP stuff, "virtual host" +configuration, per-URL dispatching[^1]; and some of what PHP itself +implements, namely GET/POST handling, plugged into a language for +general-purpose processing and automation, namely Common Lisp. Other +than that, Hunchentoot says absolutely nothing about what or how content +is generated: those basic tools are used to serve stuff, not specify the +stuff itself; it's the user's business *what* (Common Lisp) primitives +he or she uses to generate their web pages. + +Now, this Hunchentoot, while separating this from that so neatly and +generally being [a pleasure to work with][hunchentoot-example], comes +with some very big problems. Even if we left alone the usual CL-on-Unix +[retardation][logz-1934037] and the HTTP-in-CL +[string munging][hunchentoot-string] crap, its worker model +[is frail][hunchentoot-threading]. Fast, yes, but the thing hasn't been +tested on heavy workloads, so we don't know what happens when two +thousand connections come in simultaneously; the amusing part being that +yes, perhaps I should have tested this before pointing fingers at the +thing, but as it is, I have no heavy workloads to test it on! + +Other than that, there is no "Hunchentoot versus Apache" contest to +speak of, no matter how you'd choose to compare them. And if I set out +to write a Common Lisp web server from scratch, given my experience so +far, I'm not sure I'd do a much better job, at least not unless I spent +a year or so (though I'm afraid this could easily turn into "a decade or +so") reviewing this in more depth. And so, the question comes, is this +really worth doing [under the circumstances][problems]? + +As for CL-WHO: it's an honest tool for HTML generation, light-years +ahead of PHP's templating, since it's the exactly proper abstraction +level to work at[^2]. Maybe this doesn't mean much, but I'm quite proud +of the thing, since it's helped me to write a basic blog scaffolding +(this blog) and a [code referencer][coad] without much effort, and all +this stuff just works the way I'd intended it to. So given the +Republican paradigm of HTML generation [via][logz-1934283] +[IRC bots][logz-1934605], I'm supposing there's still a place for it +somewhere near the problems I was initially trying to solve. + +Then there's the CL-on-PC thread that I'd rather not resurrect: maybe +there's a Lisp to run all this stuff in, but this isn't it? + +Then there's the political aspect. Consider: at some point in the '90s, +some dudes wrote a web server and some other dudes pulled a HTML +templating language out of their asses -- meaning, they never even +specified the thing, because why the fuck, right? Either way, I guess +many man-centuries were put into making these two pieces work properly, +and so this is how today we have the A and P in LAMP. As for the other +side of the comparison: in 2000-something, some dudes set out to write +an Apache -- in Lisp. Which was great, except nobody, save for its +authors maybe, used it; so if the thing implodes under its own weight, I +would also have to foot the bill for these guys not being able to steal +WWWism from those other guys. So it occurs to me that maybe +Hunchentoot's name was [predestined][zappa]? + +So as far as I'm concerned, I'm to preserve as much of this Lisp WWW +stuff as can be preserved, and that's about it. I'll publish the current +Tar Pit's innards and I'll do my best to help anyone who wants to bring +Common Lisp WWWisms up. What I *won't* do is sink more time into +perpetuating current WWW shistacks, I'd rather burn it all and start +from scratch if the case. Or who knows, maybe at some point +Hunchentoot's strengths will find their place *somewhere*, but until +then, I'll have everything published and shelved, and that's that. + +So then, reviewing [my plan][tmsr-work-v]: I'll +spend the rest of September getting out all the yet-unpublished V +patches; then I'll work out a concrete plan for migrating this blog to +[MP-WP][mp-wp], since I suspect that won't be trivial; and finally, I'll +reprioritize the [huge to-do][tmsr-work-ii] list (plus what's landed on +this table meanwhile) and start producing other useful intellectual +things, be they this language, that other Unix or whatever. + +[^1]: Similarly to what the mod\_alias, mod\_rewrite and all those + others do. + +[^2]: It seems that the CL-WHO [illustration piece][cl-who-illustration] + is still a tough one to digest; mind you, my poor communication + skills aren't CL-WHO's fault! + + Now, consider that any use of PHP we know of actually involves the + interaction between two languages: the + "preprocessor"/templating/whatever-you-wanna-call-it language, + i.e. PHP, and the "preprocessee" language, that is, HTML. This + brings us to the practical issue of the interaction between these + two languages going *both ways*. Take the following minimal example: + + ~~~~ {.php} + + Some text, etc. + + Some more text, etc. + + ~~~~ + + The separation between HTML and PHP is clearly delineated by the `` tags, isn't it? Well no, because most of the times you're + actually going to do: + + ~~~~ {.php} + + Some text, etc. + ' . $description . ''; + ?> + + ~~~~ + + meaning that you *will be forced* to "call into" HTML from the + templating language whether you want it or not, which interleaving + CL-WHO does explicitly, correctly and at little expense -- learning + how to use it, basically. Meanwhile, on the PHPistic side of things, + just read the simple snippet above and tell me, how's that for + [pain][pain-formalized]? + +[cl-who-i]: /posts/y05/092-cl-who.html +[hunchentoot-history]: /posts/y05/093-hunchentoot-i.html +[cl-who-ii]: /posts/y05/095-cl-who-ii.html +[hunchentoot-ii]: /posts/y05/096-hunchentoot-ii.html +[hunchentoot-iii]: /posts/y06/097-hunchentoot-iii.html +[hunchentoot-iv]: /posts/y06/098-hunchentoot-iv.html +[hunchentoot-v]: /posts/y06/09b-hunchentoot-v.html +[hunchentoot-via]: /posts/y06/09c-hunchentoot-via.html +[hunchentoot-vib]: /posts/y06/09d-hunchentoot-vib.html +[hunchentoot-genesis]: /posts/y06/09f-hunchentoot-genesis.html +[logz-hunchen]: http://logs.nosuchlabs.com/log-search?q=hunchen&chan=trilema +[logz-cl-who]: http://logs.nosuchlabs.com/log-search?q=cl-who&chan=trilema +[logz-1934007]: http://logs.nosuchlabs.com/log/trilema/2019-09-06#1934007 +[hunchentoot-example]: /posts/y06/097-hunchentoot-iii.html#selection-312.0-312.1 +[logz-1934037]: http://logs.nosuchlabs.com/log/trilema/2019-09-06#1934037 +[hunchentoot-string]: /posts/y06/09c-hunchentoot-via.html#mrpp +[hunchentoot-threading]: http://trilema.com/2019/so-i-was-thinking/#comment-131250 +[problems]: /posts/y06/09e-tmsr-work-v.html#selection-220.0-220.3 +[cl-who-illustration]: /posts/y05/095-cl-who-ii.html#fn4 +[pain-formalized]: http://logs.nosuchlabs.com/log/trilema/2019-09-07#1934433 +[coad]: http://coad.thetarpit.org/ +[logz-1934283]: http://logs.nosuchlabs.com/log/trilema/2019-09-06#1934283 +[logz-1934605]: http://logs.nosuchlabs.com/log/trilema/2019-09-07#1934605 +[zappa]: https://archive.is/j5Ni9 +[tmsr-work-v]: /posts/y06/09e-tmsr-work-v.html +[mp-wp]: http://logs.nosuchlabs.com/log-search?q=mp-wp&chan=trilema +[tmsr-work-ii]: /posts/y05/090-tmsr-work-ii.html