What learning Lisp taught me about other languages
ryepup.unwashedmeme.com
ryepup.unwashedmeme.com
* two of them are common to almost all high-level languages (Python, Ruby, and Tcl all have regular syntax that deliberately improves on C/C++, and dynamic types practically define "scripting" languages),
* one of them is spurious (Visual Studio programmers don't care how much precious memory they waste as long as Intellisense keeps working, and plenty of C programmers use vim), and
* the only insight here that has enough valence to be interesting --- on the scoping and binding rules of variables --- is covered so superficially that it's hard to tell whether the author actually understands what he's saying. You mean "learning lisp" didn't teach you enough to evaluate Python's closures, or Ruby's block/lambda idiom?
This article won't be a total loss if it prompts somebody to write a more knowledgeable and useful article on the lessons a Lisp education brings to bear on modern languages. I'd love to read that.
#2 compares Lisp's minimalism to any language with more complicated syntax, not just C/C++. So I don't think this insight is "common to almost all high-level languages". (The idiosyncracies he mentions are from Ruby and Python.)
#3 isn't about Visual Studio's memory usage, it's about it being slow [1]. When I work in C#, many times a day VS is unresponsive enough to break my flow, so much so that I go off and check a website like this one (it's better than sitting there feeling angry). This is disastrous in a programming tool, so I don't think the author is being precious.
(There's also a deeper point to be made here, which is that the ultra-interactiveness of Lisp and Smalltalk environments is so different from what one experiences in the likes of Visual Studio that it makes a qualitative difference in one's programming.)
There may even be a little more to #1 than you give him. "In Lisp it feels like types are a tool I can employ when I need it" refers not just to static-vs-dynamic typing but also to the fact that one can easily write functions without having to make up types to hang them on (i.e. programs don't have to be organized into object models). That's not true of all high-level languges.
I share your desire to read more knowledgeable and useful writing on this topic. But I did like the post because it's clearly coming from real experience.
[1] Admittedly, much of this slowness is due to the add-in bizarrely known as Resharper. But that's Visual Studio's fault too - for being so backward and provincial that it needs a humongous third-party workaround to achieve bare tolerability even compared to Java.
#3 may be true for C# development; I read a lot of C#, but don't write it. But I did spend 4 years writing a significant amount of systems C++ code in VC++, and --- at least 8 years ago --- VC++ was significantly better than any comparable C environment.
We can get into a tit-for-tat on it versus, e.g. GCC, but I feel like one way to lose a programming environment shoot-out is to imply that Microsoft half-asses that part of the business.
Regarding #2, you seem to be sticking up for the author's implication that Ruby has "complex" syntax compared to Lisp. Clearly, most languages have more "idiosyncracies" (here defined as: "notation of any sort") than Lisp. That doesn't make Lisp's austerity an interesting lesson to take to other languages; it is, in fact, the major failure of Lisp.
There is a notion, unaddressed in the original post but far more important than any of that post's insights, that obsessively regular syntax is crucial to metaprogramming. Even defined down to "true macros", this is simply folk wisdom: you can get "Lisp-style macros" out of any language that gives you access to an abstract syntax tree.
Finally, call the two "mainstream" high level languages Ruby and Python (relegating Perl and PHP to uh, different, uh, categories). Both share the type system the author appreciates in Lisp.
I won't even mention macros, but I'm curious as to why you think s-expressions are a failure? It's one of the things I like BEST about Lisp.
Apologies for ranting. I've never been a big MS-hater (though I seem to be getting there), and I hardly think the Java IDE is the last word in programming environments (having an editor generate my duplicate code for me is not my idea of a good time; as you may have noticed, I like Lisp!) But like most hackers here, I care deeply about my tools, and it pains me to work in ways that feel suboptimal or ugly.
Your other points were, as usual, pretty interesting, but I burned myself out on this one. :)
> Even defined down to "true macros", this is simply folk wisdom: you can get "Lisp-style macros" out of any language that gives you access to an abstract syntax tree.
Here's what Norvig says about a particular language that has access to the AST (he's not a "convert" to Python - he just decided to use it for examples in his AI book because he feels beginning programmers can pick it up easier):
Python does not have macros. Python does have access to the abstract syntax tree of programs, but this is not for the faint of heart. On the plus side, the modules are easy to understand, and with five minutes and five lines of code I was able to get this:
>>> parse("2 + 2") ['eval_input', ['testlist', ['test', ['and_test', ['not_test', ['comparison', ['expr', ['xor_expr', ['and_expr', ['shift_expr', ['arith_expr', ['term', ['factor', ['power', ['atom', [2, '2']]]]], [14, '+'], ['term', ['factor', ['power', ['atom', [2, '2']]]]]]]]]]]]]]], [4, ''], [0, '']]
This was rather a disapointment to me. The Lisp parse of the equivalent expression is (+ 2 2). It seems that only a real expert would want to manipulate Python parse trees, whereas Lisp parse trees are simple for anyone to use.
The question is, how do you develop an aesthetic sense for these without say reading the research literature on both topics? I mean, it suffices to use the good examples of each for a while, pushing their strengths to the limit, but that at best gives folks a one dimensional view of the design of linguistic features, rather than a richer sense of strength, weaknesses, and tradeoffs.
As some other folks have mentioned, the other points are sort of irrelevant to the core of C#/++/java et al experience.
One point that seems to be missing is the (I think standard) point that interactively testing code by being able to interactively define or execute functions is FANTASTIC for developing, because it facilitates (IMHO) an easier process of evolving the software
Installed-Size: 13080
The wonders of emacs are embodied for the most part in the most primitive Lisp dialect still in widespread use. Emacs Lisp doesn't even have lexical scoping, and it's still amazing.Not that I have anything against C, when it's used to bootstrap a Lisp implementation, at least.
Still, 18-19 close parens sounds excessive. The source for ourdoings.com has 1 place with 9 close parens in a row, 4 places with 8, and 7 with 7. That's in 13KLOC.
There is probably no perfect language, and every one has its good and bad sides - it would be great to hear more about the bad sides of lisp. Simply because the arguments are never heard. I'm assuming that there are bad sides of course :-)
Why do the parentheses always come up? E.g. Crockford advocating Javascript: "You get lambdas without having to balance all those parens." But balancing all those parens is easier than balancing all those parens, curly braces, square brackets, commas, and semicolons that one is used to in other languages (again, assuming a decent editor). This is so obvious to me that I wonder whether the parenthesis business is a stand-in for other things that people really don't like about Lisp. It's harder to pin those other things down so people single out Lisp's most visibly distinctive feature - parentheses - instead. (This has the bonus of being instantly convincing to the ignorant.)
I'm not saying people should like Lisp, or that if they're intelligent enough and give it enough of a try, they will like it. I know at least two brilliant programmers who meet those criteria and don't like Lisp. (Interestingly, both favor Smalltalk.) I don't know of anyone who's quite gotten to the root of why.
Sussman has a sort of rythym when he closes parens. It was definitely a moment for me when I sort of recognised myself doing it.
I think once you have written enough functions in Lisp or Scheme, it becomes ingrained, that you sort of parens-match whilst reading back through the function.
I've only written a few thousand lines, so it doesn't take that much practice. Obviously you sort of need a real project to even make a dent in picking up a language.
I'll add that, in my experience, most claims about programming that talk about "enforcing" are rooted in theories or processes about programming that bear little relation to what hackers actually do.
Does your experience include creating a public binary API and shipping multiple versions of it? Just asking.