The aesthetics of syntactic sugar

The Unix test program makes for a great illustration of the aesthetic importance of syntactic sugar, to go along with its pragmatic effects. Consider the following two shell script lines:

if test -f /some/file; then ...
if [ -f /some/file ]; then ...

In any Bourne shell environment worth its name, these two have exactly the same results and in fact run exactly the same program (or an imitation of it), because [ is just another name for test. But at least to me, they read significantly differently, and I find that the second one looks better and reads more clearly.

(I think the problem with the first one is that everything looks the same, because it's all words and switches. In the second one, the [ and ] stand out visually and so act as useful punctuation.)

To go out on a limb, I think that this is one of the drawbacks of languages like Lisp. By having no syntax they also have no syntactic aesthetics, whether bad (all too common) or good; instead, everything disappears into an even flow of words and parentheses. There are virtues to this regularity, but I can't help but think that such languages are missing something too.

(Possibly the answer for syntax-less languages are IDEs that add in 'punctuation' in the form of colour, different fonts, and so on.)

These are my WanderingThoughts
(About the blog)

GettingAround
Full index of entries
Recent comments

This is part of CSpace, and is written by ChrisSiebenmann.

* * *

Atom feeds are available; see the bottom of most pages.

This is a DWiki.
(Help)

Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web

Search:
Written on 26 September 2008.
(Previous | Next)

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Fri Sep 26 00:28:22 2008
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.