> But I'm willing to bet that a lot more developers will be able to understand this since this is in a programming language they understand well.
This is one argument I don't buy. He talks about the Mort programmers never being able to understand Lisp. I am willing to bet, any Mort programmer who looked at this C# would not be able to understand it. I'm sure they could take advantage of it, but write it themselves, I don't think so. And anyone who could write this, can grasp Lisp themselves.
Yeah, he says that Lisp is too hard for the common man, and then sort of implies that this is because it doesn't use ALGOL derived syntax. I don't think that's the issue. It's not Mort who's fallen in love with ALGOL syntax, it's the CS graduate Elvis's who cling to their expensively acquired "skills" (priesthood memberships) with religious fervor (he says, as a CS student).
I program in C#, and lambdas and delegates are nice (I can't use expression trees because the company I work for standardizes on .NET 2.0). But the system is too gnarly, still verbose as fuck, and nowhere near as nice as Lisp (as Krishnan freely admits). This just increases the need for sophisticated developer tools and makes things more obscurantist, not less. C# is just another variation on Java, i.e. a way to drag Elvis types 10% closer to Lisp without depriving them of their oh so precious ALGOL syntax.
And anyone who could write this, can grasp Lisp themselves.
Write the memorizer? That's basic functional programming, but what does that have to do with Lisp? You could write it in JavaScript:
function memoize(f) {
var memory = {};
return function memoized(arg) {
return arg in memory ? memory[arg] : (memory[arg] = f(arg));
}
}
The big thing Lisp has left is reader and compile-time macros, and other systems [1] might be able to do both better pretty soon. Yes, Lisp has a lot to teach people who think that programming languages are passed down immutable from the superior minds of GvR or Stroustrup, but once you realize the enormous variety of decisions made in designing a language, it becomes clear that almost no number of languages will fill the space of possibilities.
A lot of ways, languages are like religions - they're part of social structure, and part of people's identity, and they tell you how to pray, when to fast, how to allocate and free memory, how to traverse the call stack, etc. But when you think about it hard enough, it's clear that all of these decisions are better made by individuals, not committees or institutions.
1. This only works if you're willing to seclude yourself in the Microsoft Yurt and never leave. Technical benefits aside, history has shown MS is not afraid to abandon projects. It's a dangerous position to take, in my opinion.
And I sincerely doubt a port of Clojure to .NET would result in a 0-difference result. We're back to the exact same problem that plagues other lisp implementations right now, which is to say we haven't really bought much.
2. It's not that different from how things are in the C world, save that you'd share more of your runtime infrastructure. My job has been full of instances where an executable interacts with a diverse set of languages. One example I work on daily includes Erlang, Ruby, Prolog, and C++ all in one space, calling around (in a structured way, of course). The implication that you cannot make modern languages communicate without a single umbrella runtime is demonstrably false.
>> one of the driving forces was to let non-geeks build software
He makes the extremely important point that the technology has failed if ordinary people can't use it to get their own work done. However, I've personally seen a project where the aim was essentially to let non-programmers program, and the result was horrendously messy. In large part, I think that's because a lot of people ended up developing that had no understanding of the underlying concepts, and as a result the output was extremely hacked together and unintuitive. I think it's great when people realize that the whole point of most software is to enable regular users to complete a task without worrying about the internal computation, but it's just as important to realize the need to _understand_ what is happening.
Shouldn't we ask ourselves if this goal is reasonable? Making arbitrary software is at the limits of our capacity right now, even if people devote their lives to it as a profession, passion, and an art.
It's one thing to take an approach like Apple Automator (a much beloved automation environment), but it's another entirely to say, "General Purpose Software should be within the grasp of the 'average person.'" It's not clear that the goal is even reasonable! A lot of software, to do what it does, requires the use of complex mathematics, algorithms, and cryptography that frequently even the implementors only vaguely understand. Manipulating those in an abstract and correct fashion is difficult in the extreme (e.g., the morass of timing attacks that have plagued modern implementations of cryptographic protocols). We can barely make software with smart people!
However, I've personally seen a project where the aim was essentially to let non-programmers program, and the result was horrendously messy.
So what? The goal of turning every user into a programmer is perfectly reasonable. Almost all users of the early systems and computers were also programmers. Even today, business users make use of Excel/Access and some macros to do some programming (even though it can be seen as basic).
Don't you remember a time when operating systems came with programming languages and compilers and actively promoted them to the user?
Oh, and HyperCard. There was another great example of "user's" programming. I've also seen some hideously ugly GIMP script-fu scripts but they worked and did the job of the "user" that wrote them.
In the end, the distinction between a user and a programmer is artificially created by software that doesn't view anybody else as smart enough to enter the monastary of the programmer.
He rambles a lot, but he's right about the need for a new Lisp, and refers to the ILC'05 presentations by Dussud, Baker, and McCarthy on "Re-inventing Lisp". Those are some pretty radical proposals. (Summaries: http://www.findinglisp.com/blog/2005/06/ilc-2005-wednesday-r...).
I think the trouble with Lisp (and Scheme) is that there's so much cruft and inconsistency beneath the veneer of simplicity (see http://tnovelli.blogspot.com/2009/08/lisp-crisis.html). Lisp is a great language to study; I just wish it was more practical and popular. It sucks having to choose between awkward (Lisp) and inflexible (everything else). :-(
Compare the C# version of memoize to this one (from On Lisp). The C# one looks very long and ugly in comparison, so I hope it isn't the new Common Lisp.
Lisp certainly has many advantages, but general readability is not one of them. Maybe when talking about complex algorithms with a sufficiently designed DSL... Here's your code reformatted:
And here is a prettier (use of TryGetValue), C# 3.0 (Func types, local variable type inference) version:
static Func<TParam, TReturn> Memoize<TParam, TReturn>(Func<TParam, TReturn> func)
{
var memoDict = new Dictionary<TParam, TReturn>();
return arg =>
{
TReturn result;
if (!memoDict.TryGetValue(arg, out result))
{
result = func(arg);
memoDict[arg] = result;
}
return result;
};
}
The C# version is clearly longer, but less dense. Most of the noise in the C# version comes from the verbose type declarations. Almost anyone could read the C# code, provided they know that => means lambda and at least heard of a closure. That is not true of the Common Lisp version. As with everything in engineering, it is a balance. Lisp is absurdly powerful and C# is absurdly clear to read. As a programmer who does a lot of maintainence programming at work, I highly appreciate that attribute of the language.
Code in unfamiliar languages always looks ugly. I know c# but not Lisp, and that just looks like ugly brackets salad to me. It can't help that your formatting as AWOL.
So your statement that The C# one looks very long and ugly is entirely subjective.
If I remember it right, Joel's "Perils of Java Schools" was about college CS programs which should be a lot more fundamental than just practical. This guy's essay conflates the equivalent of weekend carpenters, building maintenance, and civil engineers into one set of "programmers".
Hm. If Lisp would be an "everybodys" language, what would be the Lisp then?
Actually, the main success of lisp comes from its purity its scientific deepness. If you try to follow another goal, you just lose vision for your actual one.
If somebody really needs an "everybodys" language, for example because he is a lawyer or something else, okay. There is Python, Javascript, Java and many other languages who try in different ways to be for everybody. And all of them are important. As is Lisp, how it is.
[+] [-] semmons|16 years ago|reply
This is one argument I don't buy. He talks about the Mort programmers never being able to understand Lisp. I am willing to bet, any Mort programmer who looked at this C# would not be able to understand it. I'm sure they could take advantage of it, but write it themselves, I don't think so. And anyone who could write this, can grasp Lisp themselves.
[+] [-] arakyd|16 years ago|reply
I program in C#, and lambdas and delegates are nice (I can't use expression trees because the company I work for standardizes on .NET 2.0). But the system is too gnarly, still verbose as fuck, and nowhere near as nice as Lisp (as Krishnan freely admits). This just increases the need for sophisticated developer tools and makes things more obscurantist, not less. C# is just another variation on Java, i.e. a way to drag Elvis types 10% closer to Lisp without depriving them of their oh so precious ALGOL syntax.
Fuck the priesthood, seriously.
[+] [-] andreyf|16 years ago|reply
Write the memorizer? That's basic functional programming, but what does that have to do with Lisp? You could write it in JavaScript:
The big thing Lisp has left is reader and compile-time macros, and other systems [1] might be able to do both better pretty soon. Yes, Lisp has a lot to teach people who think that programming languages are passed down immutable from the superior minds of GvR or Stroustrup, but once you realize the enormous variety of decisions made in designing a language, it becomes clear that almost no number of languages will fill the space of possibilities.A lot of ways, languages are like religions - they're part of social structure, and part of people's identity, and they tell you how to pray, when to fast, how to allocate and free memory, how to traverse the call stack, etc. But when you think about it hard enough, it's clear that all of these decisions are better made by individuals, not committees or institutions.
1. http://piumarta.com/software/cola/
[+] [-] anonjon|16 years ago|reply
[deleted]
[+] [-] radu_floricica|16 years ago|reply
This is another reason we should be grateful for Clojure. It will have a .Net implementation soon, too.
[+] [-] KirinDave|16 years ago|reply
1. This only works if you're willing to seclude yourself in the Microsoft Yurt and never leave. Technical benefits aside, history has shown MS is not afraid to abandon projects. It's a dangerous position to take, in my opinion.
And I sincerely doubt a port of Clojure to .NET would result in a 0-difference result. We're back to the exact same problem that plagues other lisp implementations right now, which is to say we haven't really bought much.
2. It's not that different from how things are in the C world, save that you'd share more of your runtime infrastructure. My job has been full of instances where an executable interacts with a diverse set of languages. One example I work on daily includes Erlang, Ruby, Prolog, and C++ all in one space, calling around (in a structured way, of course). The implication that you cannot make modern languages communicate without a single umbrella runtime is demonstrably false.
[+] [-] fogus|16 years ago|reply
[+] [-] rbanffy|16 years ago|reply
[+] [-] joechung|16 years ago|reply
[+] [-] TallGuyShort|16 years ago|reply
He makes the extremely important point that the technology has failed if ordinary people can't use it to get their own work done. However, I've personally seen a project where the aim was essentially to let non-programmers program, and the result was horrendously messy. In large part, I think that's because a lot of people ended up developing that had no understanding of the underlying concepts, and as a result the output was extremely hacked together and unintuitive. I think it's great when people realize that the whole point of most software is to enable regular users to complete a task without worrying about the internal computation, but it's just as important to realize the need to _understand_ what is happening.
[+] [-] KirinDave|16 years ago|reply
It's one thing to take an approach like Apple Automator (a much beloved automation environment), but it's another entirely to say, "General Purpose Software should be within the grasp of the 'average person.'" It's not clear that the goal is even reasonable! A lot of software, to do what it does, requires the use of complex mathematics, algorithms, and cryptography that frequently even the implementors only vaguely understand. Manipulating those in an abstract and correct fashion is difficult in the extreme (e.g., the morass of timing attacks that have plagued modern implementations of cryptographic protocols). We can barely make software with smart people!
[+] [-] omouse|16 years ago|reply
So what? The goal of turning every user into a programmer is perfectly reasonable. Almost all users of the early systems and computers were also programmers. Even today, business users make use of Excel/Access and some macros to do some programming (even though it can be seen as basic).
Don't you remember a time when operating systems came with programming languages and compilers and actively promoted them to the user?
Oh, and HyperCard. There was another great example of "user's" programming. I've also seen some hideously ugly GIMP script-fu scripts but they worked and did the job of the "user" that wrote them.
In the end, the distinction between a user and a programmer is artificially created by software that doesn't view anybody else as smart enough to enter the monastary of the programmer.
[+] [-] anonjon|16 years ago|reply
[deleted]
[+] [-] rplevy|16 years ago|reply
[+] [-] tnovelli|16 years ago|reply
I think the trouble with Lisp (and Scheme) is that there's so much cruft and inconsistency beneath the veneer of simplicity (see http://tnovelli.blogspot.com/2009/08/lisp-crisis.html). Lisp is a great language to study; I just wish it was more practical and popular. It sucks having to choose between awkward (Lisp) and inflexible (everything else). :-(
[+] [-] KirinDave|16 years ago|reply
PLT Scheme is competitive in every way with Python and Ruby, I don't know why people keep ignoring it.
[+] [-] justinhj|16 years ago|reply
(defun memoize (fn) (let ((cache (make-hash-table :test #'equal))) #'(lambda (&rest args) (multiple-value-bind (val win) (gethash args cache) (if win val (setf (gethash args cache) (apply fn args)))))))
[+] [-] snprbob86|16 years ago|reply
[+] [-] StrawberryFrog|16 years ago|reply
So your statement that The C# one looks very long and ugly is entirely subjective.
[+] [-] billswift|16 years ago|reply
[+] [-] unknown|16 years ago|reply
[deleted]
[+] [-] erikb85|16 years ago|reply
[+] [-] Dave_Kean|16 years ago|reply
[deleted]