PHP vs. Lisp?
briancarper.net
briancarper.net
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.
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.
That doesn't mean- as you seem to suggest- that small little problems don't exist!
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?
Free tip: It involves ignoring all the shortcomings of PHP and highlighting all the shortcomings of Lisp.
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 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.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...
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.
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.
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".
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?
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!"
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.
What a great quote !
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?
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.
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.
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.
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....
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.
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.
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.
How do I deploy a lisp application to an end user when all I know is his operating system?
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.
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.
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.
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?
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?
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 hackers use the tools at their disposal whatever they may be.
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
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.
What doesn't he know? He's written at least one website in Lisp using SBCL+Hunchentoot.
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).
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.
- 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).
Lisp is not for sissies.
People who give the language a reputation of having a rude and insular community accelerate its death.
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.
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.
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; } ?>
$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.
I want to run my Clisp servents without any overhead.