personal website of James Turk, a developer in Washington, DC
This weekend I was helping out a friend when he pasted me some of the code from his latest project that happens to be written in C#:
(the only change I've made was to rename the identifying feature to XYZ):
namespace XYZ.Core
{
static class Entry
{
static void Main(string[] args)
{
using (Game game = new Game())
{
game.Run();
}
}
}
}
I know that monitors are getting bigger and bigger, but vertical space is still a precious commodity, so let's try turning the above code into something that looks more like:
namespace XYZ.Core
static class Entry:
static void Main(string[] args):
using (Game game = new Game())
game.Run();
This code is shorter and easier on the eyes, and I'm even ignoring the whole issue of having a class that simply has a static void main, as the authors of the cool Boo language point out, the people who came up with "public static void main" were kidding, it's just that a few million Java/C# programmers didn't get the joke.
For those of you that didn't know where this was going, the above is just a few steps away from being valid Python (or for you .NET junkies perhaps Boo). Other people have addressed the myth of significant whitespace and I won't go into great detail here, but I will say that Python essentially injects INDENT/DEDENT tokens that function in the exact same way as { and }.
What is often used as an argument against Python and other indentation-scoped languages is therefore really an advantage. {} are no more useful than the human appendix or other vestigial structures, the only reason that modern programming languages have them is that they inherited them.
If languages like Java/C# thought it was a good idea to free themselves of explicit memory management why not also free themselves of useless syntax that does nothing but clutter up code?
This divergence seems to only be growing wider, with languages like Python already free of these vestigial quirks, whereas languages like C++, Java, and C# continue to make their syntax more and more obfuscated. (eg. the tortured C++ lambda syntax)
This discussion on what syntax could be thought of as vestigial sparked some debate, some other potential candidates others suggested include the ++/-- operators and PHP's use of ->. I'd love to read comments with examples of other developers favorite vestigial syntax.
edit: A commenter over on reddit points out that the Lisp community had this right years ago. It does say something that one of the oldest languages is so free of the cruft that the traditionally more dominant curly-brace family has adopted. The idea that those who forget lisp are doomed to reinvent it is surely at work here.
James Turk is a 23 year old currently living in Washington, DC working for Sunlight Labs. This site is a place for my projects and thoughts on politics, science, development, or whatever I happen to be thinking about.
content © James Turk — cc-by unless otherwise noted