Is it feasible to do (serious) web development in Lisp?
It obviously is possible to write almost any kind of application in almost any programming language, especially in such a powerful one as Lisp (be it Scheme or Common Lisp). But is it practical to use it for web development? If so, what should be a good starting point? Where can be found the proper resources (tools, libraries, documentation, best practices, examples, etc.) for a project of this nature?
Yes, web development is one of Common Lisp's strengths today.
As a web server, use Hunchentoot, formerly known as tbnl, by Dr. Edmund Weitz.
You can run it as a back-end to Apache using mod_proxy as a reverse proxy, or as a stand-alone server.
Various HTML generation solutions are available, from PHP-style templates to Lisp macro hacks to XSLT. Just take your pick.
HTML-TEMPLATE is one example.
Closure XML is available for XML parsing, serialization, XPath 1.0, XSLT 1.0. There is also Closure HTML for HTML tag soup parsing.
(Full disclosure: I'm the maintainer of Closure XML and Closure HTML.)
If you like, Parenscript can make your JavaScript experience lispier, but you can also write plain old JavaScript yourself, of course.
Another cool JavaScript enhancing solution in jwacs, which is written in Common Lisp and transforms JavaScript to add continuation support.
Web service projects might require an HTTP client in addition to a server.
Drakma is the library to use for that today.
PURI is useful for URI manipulation.
And there is more! One starting point is cliki, for example cliki.net/web.
On the web, nobody knows your server is written in Common Lisp :-)
Web development in Common Lisp is both effective and fun.
Some examples:
CL-WHO allows you to write HTML without forgetting a closing tag ever again.
Weblocks lets you define forms declaratively with built-in validation:
(defview signup (:type form :caption "Sign up")
(username :satisfies #'valid-username)
(password :present-as dual-password :parse-as dual-password)
(receive-newsletter-p :present-as checkbox :parse-as predicate))
It also supports AJAX in a fully automatic manner, falling back to normal links if the browser doesn't support it.
cl-prevalence is an incredibly simple alternative to SQL.
Quite a lot of people are using these technologies lately for mission-critical applications -- with success.
Most important CL open-source projects in fact do have excellent community support.
There are some web frameworks out there for web development. Have a look at:
If you want well supported lisp tools then you'll need to pay for them. There just isn't a very big community around the open source tools so they don't have the same level of documentation/adoption as, say, Django on Python.
Here are some commercial lisp products:
Its also worth noting that Reddit was initially built in Lisp, but the authors later migrated to Python, citing a lack of well used and documented libraries. (link)
链接地址: http://www.djcxy.com/p/60940.html上一篇: 关于Lisp有什么了不起的?