Advertisement

Why lisp?

Started by January 31, 2004 10:00 PM
103 comments, last by Vlion 20 years, 11 months ago
quote:
Original post by HairyTroll
I think the following quote from one of the three guys who specified the Java language sums Lisp up quite nicely. As Fortran is imperitive, his quote can also be applied to C++/Java etc.

quote:
"If you give someone Fortran, he has Fortran. If you give someone Lisp, he has any language he pleases.
–Guy L. Steele Jr"




How far should this logic be taken? Why not hand someone a box of wires and a soldering iron? Obviously, this pushes the concept to the limit, but many problems can be effectively solved with the current crop of "one-language" tools. I suppose my question is: under what circumstances would Lisp provide an advantage?

-Predictor
http://will.dwinnell.com



quote:
Original post by Predictor
I suppose my question is: under what circumstances would Lisp provide an advantage?
As any program grows larger, it will surely have many instances where typical mass-market languages fail to provide the proper abstraction. You''ll end up with code duplication or very complex "hackish" code to handle the situation. I''d say that Lisp provides an advantage in any project in the long run. At first (which may be a pretty long "at first", Lisp won''t give advantage, because it''s existing libraries are pretty outdated as compared to e.g. Java or C#. You''ll need to use some time to create a set of useful tools or language extensions for the specific field you''re working in, and then you''ll start getting the benefits of tidier code.
Advertisement
quote:
Original post by Anonymous Poster
quote:
Original post by Predictor
I suppose my question is: under what circumstances would Lisp provide an advantage?
As any program grows larger, it will surely have many instances where typical mass-market languages fail to provide the proper abstraction. You''ll end up with code duplication or very complex "hackish" code to handle the situation. I''d say that Lisp provides an advantage in any project in the long run. At first (which may be a pretty long "at first", Lisp won''t give advantage, because it''s existing libraries are pretty outdated as compared to e.g. Java or C#. You''ll need to use some time to create a set of useful tools or language extensions for the specific field you''re working in, and then you''ll start getting the benefits of tidier code.

So basicly you are advocating remaking the wheel on a wide range of tools & langauge extensions? For potential ''advantages'' which are dubious to start with?

One of the reasons C/C++ have been so popular, even if the languages themselves are crud, is the vast amount of libraries and other things which add functionality to the language which is relevant for most tasks the langauge is used for . This isnt before you add the existing tools.

Microsoft has managed to force C# into the development comunity by offering massive amounts of tools, very complete libraries bundled with the language, near seamless interoperability to existing traditional code, and a clear roadmap on the expected features to the language in the next few years.

Quit frankly, I never expect Lisp or derivatives to ever make it ''big''. Lisp just doesnt offer enough clear advantages to existing and upcoming technologies. Nor is it seen to be backed by of the large IT companies.

The upcomming additions to .NET (generics & anonymous delegates being the most important), it should be possible to implement a Lisp-derived language as a 1st class language without significant hoop jumping. It should be interesting to see a Lispy language in .NET, but the fact remains: it doesnt have the tools for it.
DotLisp.
And, although not derived from lisp, there is Nemerle, which continues the ML tradition on .NET.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
quote:
Original post by ggs
So basicly you are advocating remaking the wheel on a wide range of tools & langauge extensions?
You''re making it sound worse than it really is. If some existing, non-Lisp large libraries feel very useful, you can call them via a foreign language interface. It''s a matter of interfacing them, not constructing them from scratch. The time spent there is insignificant when compared to the time taken to finish a project.

Besides, several game developers design most of their tools from scratch, starting at very low level. It''s popular to e.g. redevelop STL for PS2 development. So even remaking the wheel wouldn''t be that bad.

And with Lisp, you wouldn''t be "remaking language extensions". For example Common Lisp''s own object system kicks the C++ counterpart''s ass right out of the box. I''m talking about *creating* language extensions that you wouldn''t even dream of when thinking within the tiny box of a rigid macroless language. Creating stuff those languages don''t offer, to suit your specific needs.
quote:
For potential ''advantages'' which are dubious to start with?
Dubious for those who don''t know what they are.
quote:
One of the reasons C/C++ have been so popular, even if the languages themselves are crud, is the vast amount of libraries and other things which add functionality to the language which is relevant for most tasks the langauge is used for . This isnt before you add the existing tools.
Existing libraries (i.e. libraries you don''t have to interface) only get you some benefit, in the beginning of the project. Then you''ll hit the roof with the crud language.
quote:
Quit frankly, I never expect Lisp or derivatives to ever make it ''big''.
Me neither, but the reason is that Lisp doesn''t suit most programmers. Most programmers aren''t very competent so they need a language that gives them a couple of clear components they can use. With Lisp, you become a language designer that needs to be pretty intelligent to actually make use of what Lisp can do. It''s better for a big company to not rely on a language that only relatively few are able to really understand and make use of. For them, it''s important that they can replace a C# coder with another cheap slave. Lisp gives an advantage to small teams in which all programmers are highly competent.
quote:
Nor is it seen to be backed by of the large IT companies.
See above for the reason.
I have spent a reasonable amount of time using both Lisp and C++. They both have advantages and disadvantages out of the box. Lisp lacks much of the powerful functionality provided by the STL, and the countless libraries. C++ is much wordier than Lisp. Lisp comes with inherent support for Lambda functions, and most things are functional: operations return new values rather than modifying existing values.

However, I have come to the conclusion that the areas where Lisp provides a significant practical advantage are few and far between. With a little work you can do most of the things you can do in lisp in C++, and then still have the power to harness STL and other libraries, within a framework of a more common language like C++. A recent C/C++ Users Journal showed a reasonably simple way to add lambda functions to C++. And it's a pretty simple task to rewrite STL algorithms to work on and return containers and values rather than iterators, which I did a long time ago because I find excessive use of iterators in my code as being ugly and making things harder to follow. C++ can be modified too

The main thing touted as Lisp's superiority is the use of macros to extend the language. However, unless you are working on a project that requires a bottom-up approach with little knowledge of what the upper tiers might look like, this is not a great advantage in itself, as you can get C++ to do most of these things with macros and templates, just a bit differently. Maybe the difference will be that things like SQL will need to be enclosed in quotes and passed to a macro or function rather than used as a natural extension of the language. I don't see that as much of an issue from a practical standpoint.

It is true that harnessing the power of Lisp requires more critical thinking than many languages, but a team of all critical thinkers can work equally well in C++ or other languages.

I don't knock Lisp, I think Lisp is nice, but the notion that it's not as widespread mainly because you have to be smarter to use it is pretty shaky. Requiring more gray matter does not make something better.

It all boils down to your preferences, what you use it for, and who you are using it with. If your coworkers are more experienced in Lisp than C++, then that would probably be a good reason to use Lisp. If you are all equally experienced in Lisp and C++, I fail to see how Lisp would be a better choice for a particular problem.

quote:

I'm talking about *creating* language extensions that you wouldn't even dream of when thinking within the tiny box of a rigid macroless language. Creating stuff those languages don't offer, to suit your specific needs.



A good example of this would probably answer the original authors question, as well as mine. What would be a language extension that you could create in Lisp that you wouldnt even dream of doing in C++?

Peace

[edited by - krippy2k on February 19, 2004 9:13:44 AM]
Advertisement
quote:
A good example of this would probably answer the original authors question, as well as mine. What would be a language extension that you could create in Lisp that you wouldnt even dream of doing in C++?


Can you decide you don''t like the object system of C++ and you want to make your own? (disclaimer: I don''t know how to do that in Lisp)

What do you mean by making your own object system? A bit ambiguous. Perhaps an example of some feature of an object system that one would want that is either not already available through C++, through operator overloading, templates, or by using macros? Macros in C++ can accomplish quite a bit, as can be seen with pluggable factories, and in another recent C/C++ Users Journal it was shown how to create a ''foreach'' feature with macros in C++ that operates on containers similar to the C# feature.

Peace
quote:
Original post by Krippy2k
WPerhaps an example of some feature of an object system that one would want that is either not already available through C++


There is a famous book on Design Patterns by the gang of four. It should be required reading for anyone programming in the Java/C++ domains; most of the examples are implemented in C++. Most of those design patterns have been developed to get around various limitations in the C++/Java OO model.

Here's a section from a paper by Richard P. Gabriel, "Objects Have Failed"

Objects Have Failed

To Lisp/Scheme people, the GoF book is a joke because the patterns there are simply covering for lack of programming and abstractional power.


Peter Norvig:
Design Patterns in Dylan or Lisp

16 of 23 patterns are either invisible or simpler, due to:

  • - First-class types (6): Abstract-Factory, Flyweight, Factory-Method, State, Proxy, Chain-Of-Responsibility

  • - First-class functions (4): Command, Strategy, Template-Method, Visitor

  • -Macros (2): Interpreter, Iterator

  • -Method Combination (2): Mediator, Observer

  • -Multimethods (1): Builder

  • -Modules (1): Facade



[edited by - HairyTroll on February 19, 2004 12:44:13 PM]

[edited by - HairyTroll on February 19, 2004 12:46:48 PM]
The best thing about Lisp is that all it''s proponents are so humble.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]

This topic is closed to new replies.

Advertisement