Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
PHP vs. Lisp? (briancarper.net)
36 points by iamelgringo on Sept 22, 2008 | hide | past | favorite | 59 comments


I use Scheme day and night for web apps, but this guy makes a valid point:

An old rusty wobbly-headed crooked hammer is the best tool for the job if it's right next to you and you only need to pound in a couple of nails.


While true that an old rusty wobbly-headed crooked hammer is the best tool for the job if it's right next to you and you only need to pound in a couple of nails, we are talking about programming web applications here.

In that case, I always use good tools because typing in a few lines of Perl or Lisp is just as easy as typing in a few lines of PHP. Easier, usually.


Isn't it always just a couple more nails, here and there, till the next feature's ready to go?


Sure, commonly when you have a big project, it seems like it is just a few remaining details.

That doesn't mean- as you seem to suggest- that small little problems don't exist!


The author compares using a language and web framework he knows to one he does not know and never tried.

Feel free to guess how the rest of the article went.

PS: Why do people feel the need to post about subjects they don't know?


Can you point me to somewhere where I can download a single click install lisp stack that includes a webserver? Preferably for windows, which is what I use at work.

Can you point me to a site where all lisp functions are well documented with user comments?

Can you point me to a place where I can find a bunch of lisp libraries that are maintained and in use that I can use for my projects?

No?


Try this one: http://www.sergeykolos.com/cusp/intro/ Not everything you want, but at least an effort to make it close to your requirements.


Thank you for including the part about building an executable, and the little backstory on it.

When I first started in Lisp, one of my early questions too was, "how do you make an executable?" For a seasoned Lisper, that question might seem foreign, but it makes perfect sense to a C programmer.

I asked the question on Usenet, trying to explain that not everyone I wanted to give programs to had Lisp on their computer.

In response, someone tried to persuade me that you don't do such things with Lisp. Someone else turned out to be a Franz salesman asking, "which platforms are you talking about that don't have Lisp? we can supply Lisp on any platform!"


someone tried to persuade me that you don't do such things with Lisp

This always puzzled me too. Admittedly it's less of an issue now that we can deploy programs over the web. But it's still kind of weird.

Here's my speculative answer. The classic Lisp programmer doesn't care that much about building software for end users. He's more interested in amusing himself and, occasionally, other Lisp programmers.

I don't mean to slam Lisp (which I love) or Lisp programmers (I am one). But I believe I have observed evidence of the above.


Just mentioning, Dr Scheme has a make-exe command in the menu. But that's the only way I know how to make an exe out of a lisp program. But then I have never looked for a way either.


The classic Lisp programmer doesn't care that much about building software for end users. He's more interested in amusing himself and, occasionally, other Lisp programmers.

What a great quote !


If you were using a C compiler that produced executables that dynamically linked libc and other libraries, would you have any problems understanding that you can't run those executables on a machine that doesn't have the relevant libraries?

The lisp environment is basically the run-time library for lisp programs. In some cases, that run-time can be statically linked. In others, it can't.

You wouldn't find this confusing wrt C programs, so why is it a hard concept wrt Lisp programs?


I don't think anyone argues or don't understand this concept. The problem is: instead of answering the question: "How do I create executable?" people got lectured on why they shouldn't do that. I think it is much more productive for everyone just to give an answer and then, once you get the usual follow up question quickly explain why executable is big. This way lisp community might get more users.

But as it stands now all we hear is complaints that lisp community is bunch of jerks - the answers people get for this simple question is one of the reason why people think that the lisp community is not friendly.


> I don't think anyone argues or don't understand this concept.

The author of the original complaint clearly didn't. As he wrote: "I asked the question on Usenet, trying to explain that not everyone I wanted to give programs to had Lisp on their computer."

Lisp is the run-time for lisp "executables". Just as one can't run a C executable that depends on a dynamically loaded libc on a machine that doesn't have a dynamically loadable libc, one can't run a lisp executable without the relevant run-time.

This isn't an odd concept. Many windows programs depend on dlls.


You are correct in that I did not understand the matter when I first asked the question. However, the replies that I got did nothing to really answer it; it was just handwaving.

That was ten years ago. I understand Lisp systems quite a bit better now, but I maintain that it is a valid question. Why? You have made the point that C programs can be built to rely upon dynamic libraries, and indeed they can, and this is similar to Lisp programs relying upon the Lisp runtime.

However, C programs can also be built statically, and not have to rely upon additional libraries being present. This is not only possible, but fairly common, especially for simple programs.

If a Lisp novice is trying to build, say, "Hello World," and expects a static executable as a result, why is that so much to ask? In fact, it is a lot to ask of Lisp, but if you are new to Lisp, you are not likely to understand why.

I wouldn't expect a novice C programmer to write "Hello, World" such that it depends upon dynamic libraries; moreover, a novice ought to be able to stay busy learning C and writing ostensibly useful programs for quite a while without doing dynamic linking.

Unfortunately, it seems that too many Lisp novices don't get the answer that you have provided (which is quite a useful answer). Instead, their question is brushed off as irrelevant. At least this has been the case in the past; I could not say if anything has changed.


Huh? You said that you were a "C programmer" when you asked about running lisp executables.

When someone says "I'm a C programmer", as most folks asking about "lisp executables" on comp.lang.lisp do, I think that it's reasonable to assume that they've heard of and understand dynamic libraries.

Some lisps have static linking, some don't. I'm sorry that this was a show stopper for you.

Would an "install shield" builder, as is typically used for windows programs, have helped?

I don't suppose that you had the same reaction to Java, Python, Perl, awk, sed, tcl....


This post is proving my point: instead of answering simple questions being asked, lispers start lecturing and picking on other languages. You shouldn't know about static and dynamic linking, interpreters and compilers and other under the hood stuff to write simple lisp program (or even quite complex) and show it off to your friend without installing whole lisp implementation (maybe emacs with slime too?) on your friend's computer.

Why lispers are so elitist? Lisp is good not because it is the hardest language to learn, it is actually quite easy to pick up basic stuff, lisp is good because it is very powerful. Why make it harder for novices to try this language? This is not the way to develop the community.


Looking above, we see that you admitted that your question was answered. Lisp "executables" typically require run-times, just like "executables" in many other languages.

However, now the goal posts are moving.

The original question was how to deploy a lisp program. That typically requires the relevant run times, just as it does in every other language that uses dynamic linking and/or interpretation. (Emacs is not required to run lisp. Heck, it isn't even required to write it. Likewise, slime is a development convenience. If it's too much trouble, don't bother.)

I mentioned other languages to demonstrate that the problem is not lisp-specific.

To write a program in any language, someone has to install a compiler or interpreter and their dependencies. Folks who can't/won't do that themselves are stuck with whatever came with their system.

Again, this is not lisp-specific.

It would be nice if a reasonable lisp came pre-installed as part of linux distributions. But, like lots of other languages, it doesn't.

If you can't or won't install runtimes, there are lots of things that you can't deploy. (That's why I asked about an installation system to help automate this work.) If you can't or won't install a compiler and/or interpreter, there are lots of languages that you can't write.


You still haven't answered the question. I read the thread and now you're off ranting about other languages needing runtimes blah blah blah.

How do I deploy a lisp application to an end user when all I know is his operating system?


Look he like most people said use a "LISP compiler".

If you don't know how to do that try to google "LISP compiler" Click first link "Free Common LISP Interpreters, Compilers and Development Systems ..."

For UNIX try "CMU Common Lisp Compiler" For Windows try "Ufasoft Lisp Studio"

LISP people don't try to hold your hand and point out every last step on the path but he gave you lot's of useful information if you are willing to spend a few seconds trying to understand what they said.

PS: As soon as you start complaining about not getting enough info they stop caring. But if you asked what a good LISP compiler for windows was they would probably answer your question.


When delivering an application to an end-user, hoops that the end-user has to jump through in order to run the application ought to be considered. The optimal route, in my opinion, is to deliver a totally self-contained application that doesn't require the user to install any runtime systems whatsoever.

In that light, yes, Java is suboptimal. However, installing the JRE is pretty straightforward for end-users. Many users even already have the JRE installed. Asking an end-user to install CLisp is a whole other kettle of fish.


The Java-VM is mostly installed (and installable by-click otherwise) and Python has py2exe. I don't think many windows desktop application are written in the other languages you mentioned.

It's really sad, as lisp would probably also be great for desktop development. I mean it's not the problem of lisp - but it's unfortunately still a show-stopper for typical windows application developers.


Almost all windows applications are installed by running a specially built setup program. Often that program is itself a single exe, but not always. Occasionally there's a whole pile of files that the setup program moves to various locations.

This seems to be true regardless of the source language(s) of said application.

There are some nice tools to build said setup programs. That's why I asked whether they would be useful.


You're hand waving again. Is there a solution for deploying a lisp application to a windows end user?

If I develop an application can a user download an exe which installs the requirements and have the application run after clicking an entry in the start menu?


Yes, a tool that creates a simple to use setup for users, which allows those users to start lisp applications after an easy installation from the startmenu would be useful. Maybe that does even exist, I didn't see that so far, but it's been some time (about 3 years) since I last spend some time trying to do something like this.

I guess if it would for example install the clisp environment (if it's not installed already) and binds files with lisp extensions to it so they get executed on click that could be sufficient already. Do you know of a ready-to-use tool which does that already?


I think you're agreeing with tjr. The concept isn't hard, it makes perfect sense. What's puzzling is why it's hard to get a simple answer when you ask how to do it - or rather why the question itself is frowned upon.


I think the interesting thing is how entrenched the "web 2.0" mentality is already.

When I started programming, it was all about printed documentation. Then, it was about online documentation. Today, documentation needs to also have "user comments".

A few years ago, nobody knew what a wiki was. Now you're not a real webpage (or programming language, I guess) without one.


www.newlisp.org


that the ticket, grab for libraries written by loosers. That will make your web app shine.


You are starting wrong. Real programmers won´t use Windows even at gunpoint. Windows is good mostly for gaming. For Photoshop, there is OSX, which is a full fledged Unix. For people who use Real Operating Systems, a bunch of Lisp environments (including Emacs + Slime) are just an apt-get away. Weblocks seems to be a nice web framework. As for the third hit on Google (Kanamit), it was a prank.

As for #2, http://www.lispworks.com/documentation/HyperSpec/Front/index... seems to be a good start

As for #3, that one got me. I am mostly a Python/Plone guy learning Django, but I am sure plenty was developed in the last couple decades for Lisp. Since it takes a smart person to do it, you shouldn't find lots of lousy stuff.


Real programmers won´t use Windows even at gunpoint

Real hackers use the tools at their disposal whatever they may be.


The Tao gave birth to machine language. Machine language gave birth to the assembler.

The assembler gave birth to the compiler. Now there are ten thousand languages.

Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.

But do not program in COBOL if you can avoid it.

:%s/COBOL/Windows/g


+1

I think I am going to have to write a sarcastic reply to this post. "PHP is much simpler! First, you have to setup Apache just to get 'Hello world' working with PHP. That's OK though, because installing and configuring a web server is fun and exciting. After that, you can start work. Of course, you have no libraries, so you get to write everything from scratch. While you're doing that, be sure not to use $i as your loop iterator, because there is no lexical scope! Do you need closures? They don't exist! You don't need that for web pages, though; web pages require you to write spaghetti because it's just plain easier! Anyway, eventually you will want an editor with decent syntax highlighting and perhaps a REPL for prototyping. Oh wait, PHP has neither. That's OK though, because PHP is clearly better!!11!"

I could go on, but I'd rather summarize this with one word: "blub".

Oh, let me add one other thing. He says MySQL is a single apt-get away, but installing SLIME and Emacs was "too hard"? On my Debian, emacs22, slime, and cl-swank are all an apt-get away. In fact:

    $ apt-cache search '^php5' | wc -l
    51

    $ apt-cache search '^cl-' | wc -l
    168
That's OK, though. If you know PHP and have no ability to program or learn anything new, CL probably isn't for you.


Not that I disagree with your point, but as a PHP developer myself:

1 - PHP does not require Apache. There is a command-line PHP interpreter: `apt-get install php5-cli` allows you to do `php <filename>` and such just fine.

2 - PHP has a lot more libraries available than just what you find in your Apt repositories, such as PEAR, which is PHP's equivalent of CPAN.

3 - Just about every editor I know of has excellent syntax highlighting for PHP; some even go so far as to contextually highlight HTML/CSS/SQL code as it appears in the middle of your PHP code.

4 - As for a REPL, check out [phpsh](http://www.phpsh.org).

5 - Your point of not using $i for an iterator is absurd, although your point of scoping is not. Using $i for iterators is perfectly fine and sane, assuming the obvious act of not using iterator variables outside hte scope of what they're iterating, which IMO should be standard proctice anyways just for the purpose of clarity...


1 - PHP does not require Apache. There is a command-line PHP interpreter: `apt-get install php5-cli` allows you to do `php <filename>` and such just fine.

Sure, but there is no "./server" that I can run in a directory of PHP files to bring up a testing server. You can run tests from the command-line, which is good, but you can't see web pages without a web server. What a pain.


I still don't see how that's any different than any other language. Something somewhere has have a web server implemented in order for you to test things in your browser. And if you don't like Apache, there's always Lighttpd and other web server options.

Probably the best thing for PHP though is that once you set up your trivial testing server, you never have to touch it again. You just keep refreshing the page, or pointing the browser at new pages, no matter how much code you write or file structures you change. It just works.


Yeah, but every time you get a new machine you have to install Apache and setup the httpd.conf. That is a lot of work for a non-production environemnt.

Anyway, PHP is the only langauge that does this. Catalyst, Rails, Django, etc. all have their own server. CL has Hutchentoot. It's just PHP that requires a production environment for testing "hello world".


Not to mention that if you're on windows you can just download the Wamp stack executable and you're done. One click.


Or you can go to Dreamhost / insert your favourite cheap hosting site here - and throw up your files for $5 a month. Try that with lisp.


"The author compares using a language and web framework he knows to one he does not know and never tried."

What doesn't he know? He's written at least one website in Lisp using SBCL+Hunchentoot.


Feel free to guess how the rest of the article went.

Free tip: It involves ignoring all the shortcomings of PHP and highlighting all the shortcomings of Lisp.


Eh?

PHP is overly verbose and terribly inconsistent and lacks powerful methods of abstraction and proper closures and easy-to-use meta-programming goodness and Lisp-macro syntactic wonders; in that sense it's not a very powerful language.


I'd go with a compromise along the lines of Ruby or Python, myself.


The real problem with PHP is that (despite the ability to run it from command line, etc...) a language centered around web application. That's also it's greatest strength: it's seamless and easy to integrate with Apache.

I wonder why the author wouldn't consider Perl: powerful Apache integration (mod_perl), performance and great deal of expressive power. A PHP code monkey could be trained to modify Perl and the presence of powerful and mature testing tools (e.g. Test::More) and common libraries (DBI, myriad of XML libraries, template libraries, etc...) can minimize the amount of damage a junior coder will do.

(And if you're unable to use mod_perl, using CGI::Fast suffices for most cases and is trivial with mod_fastcgi).


It seems the primary complaint here has to do with setting up Lisp web application infrastructure.

Granted, it's not as out-of-the-box as getting started with PHP, but once you've done your first Lisp web application, successive applications will be much easier.


The other complaints are:

- not much in terms of community to help answer questions or maintain your code, whether a guy down the hallway, documentation, or answers to questions you can Google for - much greater probability of a random library existing for PHP than for Lisp (which is perhaps another case of the first point)

I keep coming back to Clojure as a way to do Lisp and still get many of the benefits of building on a popular platform (Java, in Clojure's case).


Scheme implementations on the JVM have the added benefit that it's easy to find CS grads with Scheme on the resume. Not that it takes much time to pick up, but having it on resumes fits mainstream hiring practices better.


When he says "not much in terms of community to help answer questions or maintain your code", he meant "I can´t google my way out of a tough programming problem"

Lisp is not for sissies.


Sometimes really remarkable programmers start out as "sissies", you know.

People who give the language a reputation of having a rude and insular community accelerate its death.


As opposed to the sophisticated self-proclaimed programmers who give PHP the reputation of being such an elegant tool.

Really remarkable programmers usually don't start out as sissies - they use, understand and improve upon the tools other remarkable programmers gave them. Or invent completely new ones.

And that is one reason why not to use Windows - it really won't help that goal. The whole environment is not conductive to this king of tool refinement.


I'm pretty sure nobody is saying PHP is elegant, just that they think it's easier to set up and drop in place than Lisp, and it's easier to find junior programmers familiar with it. Several loud voices in the Lisp community have implied that this isn't really a problem, which is a great way to convince people to write it off as a web programming platform.

Instead comparing PHP to Lisp for that purpose, I'd be more interested in a comparison between PHP and Python or PHP and Ruby.


"Instead comparing PHP to Lisp for that purpose, I'd be more interested in a comparison between PHP and Python or PHP and Ruby."

I agree. More to the point, it would be more interesting to compare PHP frameworks to Rails or Django, as Ruby and Python are more general purpose languages and PHP, while it can be used for other things, is built to generate HTML.

The original (quite lame) article is in the lines that "I tried to use this ocean liner to go to the supermarket and it is infinitely less convenient than the car I was used to. Nobody should use ocean liners because cars are more convenient". It´s awful.


I think the comparison Brian Hurt makes between "core" and "edge" languages (http://enfranchisedmind.com/blog/2008/09/20/programming-lang...) is pretty relevant here. "Edge" languages are often used as "glue" languages, because they're good at wrapping separate components and making them work together, while "core" languages are usually better for complicated systems that do most of their work internally, such as compilers. Lisp and OCaml are primarily core languages, while Python and Perl are primarily edge languages.


No, Lisp is for weenies.


There are some highly idiosyncratic bugs/problems I'd rather find the solution to on Google because finding the solution myself wouldn't be very edifying.


I see the complaint as this: Does Lisp Feature a PECL Installer? - What if you need a clustered server environment - how are you going to role out a large application to 20, 30, 500 servers? PECL and PHP Offers libraries (functions really) to accomplish much more off the shelf through it's Standard Library than many other languages. -Compiled-In DB Drivers (MSSQL,MYSQL,PGSQL,ODBC,SQLITE) -LDAP -KADM5 -Mcrypt -PDO -Sockets -XML -SOAP -(an excellent set of string and array functions)

Actually can someone who knows more about .Net, Ruby, or Java tell me of the features I listed what languages have these features that come with, or are optional?

I don't find the language to be ugly, dirty, or unpleasant. Java is the most popular programming language in the world, and I cannot stand it, if I have to create one more NEW object simply to format CSS text I am going to explode.

I have no problem properly naming and using 1,000 functions. I would rather know each function than have 10 objects with 100 methods each. Objects have their place for Webapps (which ultimately output text last time I checked) Web Applications do not need to be abstracted to the point of Object Inheritance Oblivion!

Can someone please tell me of all the better ways to write this in other languages that are so far superior to PHP?

<?php $br = "<br />"; if(!empty($_SERVER['HTTP_REFERRER'] && !stripos($_SERVER['HTTP_REFERRER'],$_SERVER['HTTP_HOST'])) { print "Remote Login Denied!" . $br; } else { print "Success!" . $br; } ?>


Here is even a better way...

$br = "<br />" && !empty($_SERVER['HTTP_REFERRER'] && !stripos($_SERVER['HTTP_REFERRER'],$_SERVER['HTTP_HOST']) && print("Remote Login Denied!" . $br;) || print("Success!" . $br);

I always code like this and call it if-less programming. No matter how smart the new grad is, they find it very hard to follow:-) Job security dude.


Does anyone know of Clisp web server hosting?

I want to run my Clisp servents without any overhead.


I couldn't even think of opening this. Its like comparing pig shit with gold bars.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: