guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Code for fun] Announce my generic server Ragnarok


From: Nala Ginrut
Subject: [Code for fun] Announce my generic server Ragnarok
Date: Tue, 3 Apr 2012 00:23:23 +0800

hi falks!
Many guys believe Guile-2.0 is powerful, me too. But we need more and more guile projects to prove that.
Here's a toy of my coding game. A generic server named "Ragnarok". The keyword "generic" implied it's not only a http-server, but easy
to add new protocols without considering the common features for a server such as config/logger/concurrent...  
If you checkout its code, you may find that it may didn't use web API you thought in Guile lib, and it's bother to implement epoll though Andy is 
making effort to writing nio/ethread now. Well, the reason is simple, because that API/epoll did exist or not stable at the time I wrote Ragnarok. I think it's easy to port it to our future nio/ethread for a higher concurrency. 
It's here: git://gitorious.org/glow/ragnarok.git
I'll make a main page for it if I find a proper web hosting.

Features:
* GPLv3 (of course)
* Object oriented 
 (yes, I'm the minority in Guile community who try to program with GOOPS, though FP features may cancel out most of OO features)
*  HTTP/1.1
*  Multi-protocols
*  Multi-languages
 (Guile is actually a dynamic compiler collection against the GCC who's the static one according to Andy's free speech. So multi-language
must be the most fascinating feature.)
*  Guile/Scheme Template
*  Configurable
*  MIME
*  Unified epoll/select/kqueue interface
*  Logger
*  Standard CGI
*  Static page and binary downloading service (of course)  

These days I'm on my vacation and gave a free speech to Chengdu Linux User Group for a topic about Guile. Many guys are interested in
using Scheme for web framework. But they thought it's very clumsy to write Scheme in web development, they love PHP more. 
For such a misunderstanding, I showed them one of the features in Ragnarok, the Guile template:
---------------------------------cut----------------------------------
<html>
<% (if (= 1 1) (begin %>
<p>asdf: <%= (+ 1 1) %></p>
<% )) %>

<% (let ((test-me (expt 3 8))) %>
<p><%= test-me %></p>
<% ) %>
</html>
----------------------------------end-------------------------------

If you get this dynamic page from Ragnarok server, the result will be:
=================
<html>
<p>asdf: 2</p>
<p>6561</p>
</html>
=================
Or open it from any web-browser you like.

Well, it's an interesting feature and easy to implement for most guys in Lisp world. 
The point is, I'm telling them the template is not a big deal for Guile. We have it.

After the free talking, an audience ask me: why not release it?
I must confess it's just a toy of my coding game. I didn't know if people will be interested in it.
And many guys here know much than me, so I'm hesitating. 
But the sentence on Geiser[1] site struck me: "No hacker is an island". Then I believe I must share it to the world and get more help.
Anyway, it's buggy but it really works!
If you're in trouble with running it directly, you may try to use it's <server> class for debugging or working with it:
--------------------------------------------cut-----------------------------------
(use-modules (ragnarok server))
(server:run (make <server> #:name "first-http"))
--------------------------------------------end----------------------------------
Then you get a http server listen in 8080 in default. 
Happy hacking!


[1] http://www.nongnu.org/geiser/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]