Hacker News new | ask | show | jobs
PG: If starting Viaweb today, would you use Lisp?
30 points by aswanny 6909 days ago
Question behind the question: All things being equal (libraries,etc) does it support a better mental framework for development than ruby, python, etc?
8 comments

Lisp as an alternative to C++ makes more sense than Lisp as an alternative to Python.
Probably.
Nicely understating the obvious. I approve :).
Yeah, he could have said "Probably, dumbass." Nice guy. Up that man's karma.
Look at the last two paragraphs of the "Blub Paradox" section of Beating the Averages:

http://www.paulgraham.com/avg.html

I think that answers your question behind the question. Then read the whole essay. It's good.

You've heard of Arc, right? You're soaking in it.
Just yesterday I had a thought about the link between Paul and Lisp. I came to the conclusion that since Paul was a published author of Lisp books at the time, and saw an opportunity to use it in production (maybe to gain experience and write another book about it to share his findings with others) but ended up learning about startups, dot coms, investors, and users as well, he instead wrote essays on paulgraham.com and used some of them in his Hackers and Painters book.

I dare say his essays are about starting up in general, and there is no secret plan to convert users into using Lisp. Every week on YCombinator Startup News, somebody asks about learning Lisp to do a web app, when there are way more other things to worry about than the language. Use something you want to use every day, not just in theory because someone else did. I'd learn an unknown language if I was at a startup that used it every day, but otherwise, I would default to using a web framework that I have already used in the past.

My conclusion is that if you're creating a web application using a web framework in any language you find interesting at the moment, go for it. Because that's exactly what Paul did. It just happened to be Lisp that he was an expert at, but it could have been any other exciting technology.

Whether Paul would use Lisp today or not on a new project is irrelevant as far as your plate is concerned. He could use Lisp, but it wouldn't mean that there aren't other good alternatives. And if he did use a language other than Lisp, maybe it would be so because he would want to learn web framework since he wouldn't be writing Lisp books any more, but Lisp may still be something he would normally use more often.

I think this is a great question.

In photography, there are way more other things to worry about than what kind of camera you're using, but you'll notice the pros don't use point-and-shoot.

A piano concert's quality depends much more on the pianist than the piano, but you'll notice the pros don't give concerts on uprights.

If you have a choice of several languages, it is, all other things being equal, a mistake to program in anything but the most powerful one.

True, but all other things are rarely equal. I recently talked to a client about building a simple online project tracking app. I think it would be a mistake to use anything but Rails, as the application is already more than half done as soon as Rails is installed.
So you are asking: "If PG had to engage in an air war today, would he choose an F-16 or a Sopwith Camel?"

The point is that he thought at the time, and still (probably) thinks, that Lisp is language superior in power. As far as I know, no other language has eclipsed it, so the answer hasn't changed.

At least, that's the argument that has compelled me to re-visit it (after learning some Scheme in undergrad).

No other language has eclipsed it, but other languages are much, much more disciplined than Common Lisp. And you need a little discipline to build a community, which is required for a programming language to succeed.

For example, the fact that 'foo creates the symbol foo if it doesn't exist is undisciplined. That means if you try to reference something in a certain package, then find you didn't import that package yet, then try to import the package, it will fail. The reason it fails is because you've already created 'foo, so it can't import 'foo.

That's just one example. Lisp is the most powerful code abstraction, but it needs discipline to succeed.

Having heard "Lisp would be popular only if X were true" many times over the years, I've developed a quick test for such statements. I take a quick mental tour through languages that have become popular, and stop when I arrive at an example where X is false. If I ever get to the end of my list and X has been true for all of them, I might actually believe the statement.

Left as an exercise for the reader: Are there any languages that have become popular despite not having discipline built into the language? If so, then it's not a prerequisite for popularity.

I'm referring to languages that weren't primarily pushed by big companies to make them popular. For example, Ruby.
Would you describe PHP as having discipline built in? I notice for your CL example of lack of discipline you chose a namespace issue.
..That would be the polar opposite of undisciplined. Like I said, a little discipline, not.. erm.. bondage and discipline. :)
That little example will probably save me some misery later. Thanks!
It's one example I'm hoping will be absent from Arc.
Doesn't anybody at YC.news use Haskell...?
For hobby stuff, yeah. Not for startup. (Though I'm seriously considering using Erlang in one area, and I've got a friend with an Erlang startup.)
Oooh, that's interesting. What is the name and what do they do (if you can tell any of this information)?
I don't think it matters. If you know Lisp you should be able to decide wheter it's the right tool for your project or not. If you don't know Lisp you should do a little effort and try to learn it. Whatever the Pauls answer is (but I imagine the it will be something like "Yes" or "Arc").

I'm learning Lisp right now. Reading the Practical Common Lisk on the web http://www.gigamonkeys.com/book/ until my dead-tree copy arrives (I'm also waiting for my copy of ANSI Common Lisp. Paul, if I manage to get to the face-to-face interview on Boston for that Y-Combinator round, do you mind if I ask you to sign to book? pleeease ^_^), and so I currently better building a website with Perl+Catalyst+MySQL than with Lisp. Probably when I get more confidence with Lisp it will change.

So, although Paul is a great writter and a really great hacker his answer to that concrete question has not really a lot of value. And, I've previously said I bet a beer-token that the answer will be something that evaluates to true.

It is rather interesting to look at Paul's list of implementations of an accmulator in different languages:

http://www.paulgraham.com/accgen.html

In my very biased and unlearned view the simplest readable versions are Javascript and Lua. And Lua has server side libraries for CGI and SQL and other goodies (search for Xavante on the net). Just a tip for those poking around for readable and clean language alternatives. And Lua just got up to position 18 on the Tiobe index this month.

http://www.tiobe.com/tpci.htm

Hackers and Paiter page 161, The hundred years language:

"How far will this flattening of data structures go? I can think of possibilities that shock even me, with my consiously broadened mind. Will we get rid of arrays for example? After all, they're just a subset of hash tables where the keys are vectors of integers."

Lua does exactly this. And is quite efficient anyway.

Anders Holtsberg

> In my very biased and unlearned view the simplest readable versions are Javascript and Lua.

The Python version listed there doesn't actually meet the requirement (it doesn't return a function, it returns a class instance, and it keeps modifying n every time it's called).

Corrected version:

  def foo(n): return lambda (i): n+i
Which is essentially identical to the Common Lisp version.
If it's supposed to be an accumulator, I take it they want the value of n to be changed each time. I'd do:

    def acc(n):
        while True:
            n += yield n
But emphasizing correctness makes my one-liner not work! And reading the original I can see this whole issue was already covered!

BTW, generators are non-callable.

Dude, have you not read his essays?
Yeah, I forgot. It's been a few years since I read it.
You'd probably be better off using Rails or Django right now. Writing a web framework in Lisp is an order of magnitude harder than just using a battle tested one.
FWIW, Hunchentoot has performed flawlessly for me, and it is very easy to work with. I use it for clutu ( http://clutu.com/ ) among other things.

[edit: I'm not entirely sure what people mean when they say web framework, so apologies if Hunchentoot wasn't what you meant.]

I think most people mean something more like Uncommonweb or KPAX. I built a fairly sophisticated application for a client using TBNL (now Hunchentoot), CL-WHO and CLSQL.

Building a web application doesn't require a framework; it does require a set of libraries to handle talking over http, generating HTML and often talking to a database. Since most frameworks include these, some people may confuse the two. A framework is really just a half-done bottom-up application, which is pretty useful when it matches the kind of application you're building and pretty useless otherwise.

Here's a lisp web framework: http://www.defmacro.org/ramblings/weblocks-demo.html

But the idea is that what you get out of lisp is an order of magnitude more power than other battle-tested ones, right? I ask this in seriousness, not to provoke a flame war.