>Messy Syntax??

>XML programming languages like XProc, XSLT, and even XQuery get a bad rap at times from programmers. Mainly because there are lots of xml tags and xml namespace prefixes that are used within these languages. XQuery being more popular because of it’s compact syntax form.

So it’s always funny when I see some new hot language that many like, but is just as messy as an XML based language which many hate. Most recent of these is Clojure:


(defn show-guestbook [{:keys [user user-service]}]
(let [all-greetings (greetings/find-all)]
(html [:html [:head [:title "Guestbook"]]
[:body
(if user
[:p "Hello, " (.getNickname user) "! (You can "
(link-to (.createLogoutURL user-service "/") "sign out")
".)"]
[:p "Hello! (You can "
(link-to (.createLoginURL user-service "/") "sign in")
" to include your name with your greeting when you post.)"])
(if (empty? all-greetings)
[:p "The guestbook has no messages."]
(map (fn [greeting]
[:div
[:p (if (greeting :author) [:strong (greeting :author)] "An anonymous guest") " wrote:"]
[:blockquote (h (greeting :content))]])
all-greetings))
(form-to [POST "/sign"]
[:div (text-area "content" "")]
[:div (submit-button "Post Greeting")])]])))

Seems to be about as messy syntactically as any of the XML based languages out there. Clojure itself is a functional language, and so is XSLT 2.0. Anyways, to each his own, but some of these modern DSLs and programming languages can be just as ugly as the ones that came before it.

Advertisements
This entry was posted in eclipse, xml. Bookmark the permalink.

One Response to >Messy Syntax??

  1. >Wonderful post, thanks for putting this together! "This is obviously one great post. Thanks for the valuable information and insights you have so provided here. Keep it up!"Dissertation Writing | Dissertation Advice

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s