Parenthesis Syntax

I’m going to a talk on F# tonight in the Cleveland area. It’s not something I’ll likely get to use in my job, but it’s interesting, and I like to check out different languages. I’ve played around with the language and it seems to have some promise. I like some of the newer functional languages like F# and Haskell.

I was thinking about the syntax though, and I think there are some interesting misconceptions about syntax. People get excited about these languages because they bring the power of functional languages without the pain of lisp-style syntax.

(operator arguments)

That is the lisp syntax. Period. Define a function? Check. Variable? Check. Use a built-in function or operator? Check. Programmer defined function? Check. Create a block? Check. You get the idea.

The first misconception is that this syntax is tied to functional languages. It is, but for historical reasons. It’s essentially just a raw syntax tree. Other types of languages could be spec’d to use this syntax.

The second misconception is that it’s archaic and useless. I’m not saying it’s prefect, but it’s simplicity means one thing. Writing code that works with code is easier than anywhere else. Everything can be parsed with the same recursive processive. There are essentially no edge-cases.

In today’s programming world, we are searching for features in dynamic languages that allow code-as-data and dynamic evaluation. Think of the fuss of XML and now JSON. There was a syntax built for these needs long ago, we just struggle with the baggage they carry.

And people complain about the parenthesis. With good IDE support and sane whitespacing practice by the developer, this isn’t an issue anymore.

This isn’t a Lisp endorsement, and I’m not saying that every language should use that syntax. But understanding the reason for it helps understand the problems with some of the modern languages that are trying to provide the flexibility that Lisp did.


Posted

in

by

Tags: