by drmeister · 8y ago · 0 comments
I am heavily invested in Common Lisp. We are developing a programming environment for designing new materials and molecules called Cando (https://github.com/drmeister/cando) using Common Lisp as a scripting language. Cando is running on Clasp (https://github.com/clasp-developers/clasp), a new Common Lisp implementation that interoperates with C++ and is based on LLVM.
What attracted me to the language, after 35 years programming in almost everything else, was how organically it lets one write software and how I don't have to worry about it fading like the next programming fad.
Have you had an opportunity to look at Julia? It seems that there is some overlap in what can be achieved - with some obvious differences: as I understand it you had a lot of c++ - that could probably (today) be linked from julia, but not "integrated", starting from a green field with Julia, ideally one could do most things in Julia - maybe with some help from rust. And Julia is not a common lisp, obviously.
But in merging a high level language and the love, it seems Julia has been successful in getting a lot of real-world, "all Julia" libraries, with "sufficient" performance.
If you were starting over today - would you still prefer to build a common lisp with close integration to c++?
I did choose Common Lisp over Julia - I started learning Common Lisp in 2013 and Julia started becoming something around 2012.
I did so because of the permanence and the demonstrated expressiveness and power of Common Lisp. Common Lisp has been around for almost five times longer than Julia, and Common Lisp has demonstrated again and again that it is capable of solving hard, poorly understood, real world problems in a lot of domains.
Fun fact: Julia bootstraps off of an implementation of Lisp. Furthermore, most compiled languages are translated into an abstract syntax tree (AST) as part of compilation. Lisp S-expressions are a text based AST. So I can make the argument that Lisp is as close the "One True Programming Language" that we have. :-)
I'm doing chemistry - that's fundamental and timeless - I find it maps beautifully to a fundamental and timeless language like Lisp.
[1]: http://terralang.org/api.html#using-c-inside-terra . The same idea also occurs in e.g. Python DragonFFI.
We exposed the AST and ASTMatcher libraries of Clang inside of Clasp and we use it to analyze all of the Clasp C++ code to build an interface to the Memory Pool System memory manager.
I want to have something that can include C and C++ header files and automatically expose them to the Common Lisp - that would be neat! Maybe we can steal some ideas like the includec function of Terra.
And you're my hero. For having the big courage to write a completely new CL implementation, and attempting what wasn't attempted before: LLVM output, great C++ interoperability. Even more, leveraging the latest state-of-the-art compiler modules (Cleavir, etc.)
Keep on with the good work, dr. Schafmeister!!
I'm not sure I understand this bit. What other programming language has "faded" and how has it "faded"? At least since the more mature age of software, which I'd say started around '95 or so (so 20+ years).
Common Lisp doesn't have this problem - and it has many features that other languages have added over time, often in less comprehensive ways. For example C++11 lambdas are not as expressive and powerful as Common Lisp first class functions, and I joke that C++ template programming is to Common Lisp macros what IRS tax forms are to poetry. Note: Clasp includes a lot of C++ template programming and C++ lambda code that I enjoyed writing and I am so grateful that C++11 added variadic templates. New language features can be added to Common Lisp by the programmer with macros, and for the really adventurous, they can be made efficient by augmenting the Common Lisp compiler. Common Lisp compilers are almost always written in Common Lisp and available and accessible. This is why Clasp uses a new and understandable Common Lisp compiler "Cleavir" (developed by Robert Strandh) and LLVM, which is a great C++ library for generating native code on a variety of processors. Cleavir will be an excellent platform for efficiently implementing new dynamic programming language features.
While that made for very nice war stories, it also meant that you’d have the “ship” sinking under you completely. Now a tech still stays around to some degree.
A C developer from 1990 could still be a C dev in 2018. A Java dev from 1998 could still be a C dev in 2018. And a programmer in your average mainstream language in 2018 could reasonably expect to be working in the same language in 2018. Especially if that language has enterprise traction (Cobol, Java, C#, Javascript, SQL, etc.).
Also, languages are a lot more similar to each other than they used to be, in terms of expressiveness and power. Lisp was a “lightsaber” to the “stones” of the 80’s, now it’s at most a slightly more powerful “machine-gun”, at best.
And regarding language evolution itself, everything evolves. Or did Common Lisp programmers generally write unit tests, have integration test harnesses, use package repos, etc. back in 1995? I somehow doubt that :)
Common Lisp also has an excellent package manager (quicklisp/ASDF) a programmers IDE (emacs/slime vim/vlime), interoperation with C libraries (CFFI) and lots and lots of libraries that don't need to be constantly updated to keep them working because the underlying language changes.
I wouldn't call it just a slightly more powerful weapon.
Just the macros - my goodness - in Common Lisp you can write programs that write programs! It's easy and organic and elegant because they are written in the same language as everything else. Macros let you write code that customizes itself and optimizes itself at compile time for specific use cases. You can escape the drudgery of writing similar code over and over again. You kind of need s-expression syntax for macros to be easy to write - so no other language with complex syntax will ever have them like Common Lisp does.
Languages are all Turing complete - we can do everything in every language - but for the kind of hard problems that I want to solve, only Common Lisp has helped me out of the Turing tarpit. Also, C++ is a great domain specific language for creating tables of cache friendly compact data structures and it has great compilers.
If one used a Lisp system at MIT in the 80s, probably.
The typical Lisp Machine at MIT was networked and shared file servers (also from other types of machines). When one uses a Lisp Machine on the network, one uses a name server (not DNS or NIS, which did not exist at that time) which define one or more sites. The site information in the name server provides information about machines, services, users, printers etc. In the 80s the MIT network was already vast with hundreds of machines. It was basically similar to what Unix system did with mounted NFS volumes, but here built into the Lisp system. This was before TCP/IP, when Lisp Machines used the CHAOS protocol for networking.
Now when one wanted to load some software into a Lisp Machine, one uses a command like 'Load System FOO', where FOO is the name of the system. The Lisp Machine shares with other machines a central registry for system names, which then point to a location in the file system. So this would find the system definition, load it and then load the system components. One could also ask it to load a specific version or load a specific patch level - or just the newest version. A system could also have other files like documentation, C files, etc.. There was also a way to write those to tape or an archive format and transfer it that way.
Thus that was a networked repository for libraries and applications. Some of those libraries were shared across different machine types and Lisp dialects. For example the LOOP feature was a library sharing source code with Maclisp, Zetalisp, NIL, etc. So you could load this from a central location into different Lisp systems - not just Lisp Machines.
Richard Waters wrote and made available a nice pair of utilities that I've long used.
http://www.cs.cmu.edu/Groups/AI/util/lang/lisp/code/testing/...
http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/l...
The first is the RT package, which allows definition and execution of unit tests. Many elaborations of this have been written over the years.
The second, COVER, is more impressive: it uses Common Lisp macrology to implement a code coverage tool. Combined with RT you can not only unit test your code, you can confirm the level of branch coverage your unit tests achieve.
(I've since hacked up COVER to enable various extensions, including saving of coverage information for aggregation from different executions, and rollback to enable automated search for minimal coverage-improving inputs. Not available publicly right now, unfortunately.)
Please elaborate more and explain.
Pretty radical claim there, are you sure about that? :)
I will definitely be stealing this quote in the future! Well put.
C++ template programming necessarily followed a very different style than it does since variadic template were introduced with C++11. There were books written before C++11 wherein much of them was obsoleted by variadic templates. You do not want to let students get hold of those books and think the old way was the way things have to be done. Compare how boost::python was (is? I haven't dug into it recently) written compared to pybind11 - night and day differences in readability thanks to variadic templates. That's not a dig at boost::python - it was written with the C++ they had back then and it had to use Lisp-like list comprehension with tedious replicated boilerplate code to unpack argument lists.
Then there are raw pointers in C++ - we aren't supposed to use raw pointers anymore. We are supposed to use references and std::unique_ptr<x> and std::shared_ptr<y> and this thing called "move semantics". That stuff sucks for directed graphs and so I switched to compacting, tracing garbage collection for Cando.
C++ is being developed in a way that it retains backward compatibility with existing code - thank goodness for that! But there are styles of programming even for something as staid and venerable as C++ that, while supported, should pass silently into the long, dark night.
Then you have a language like Python that made sensible but breaking changes between versions 2.x and 3.x. Wow - look at the problems that is still causing. I love Python but I won't do anything with it that I can't rip out root and branch with more than a few weeks work. I say that even though Clasp's build system is completely implemented using the very excellent Python based build system 'waf'.
Then you have Javascript - it seems to change every time I blink. That doesn't mean I will stop using it for our web based Jupyter notebook user interface. Javascript is the only game in that town. I just close my eyes and hold on tight and try not to scream.
Common Lisp isn't like any of those, it grew out of a lot of very careful thinking and was specified around 1984 darn near perfect. There are some warts (logical pathnames - I'm looking at you) but even its warts are better thought out than some other languages features. Better implementations and more and better libraries come along - but the language has the same expressiveness, power and permanence it has always had.
Cobol? Seriously, there are probably more Cobol programmers than there are Python programmers.
And C? Most of the world runs on C, and its irreplaceable language in a non desktop computer.
And you will be surprised how much Perl code is written everyday.
The root comment is talking about the fad of the year, the kind of a language web devs use as flavor of the year. The current ones are Javascript frameworks. In this case the 'fade' is just the web framework, that probably has less mind share and open source dev contributions.
(I did have C in there but edited it out. I don't think that's a dead language yet.)
But ML, Eiffel and Modula were never mainstream.
And Perl, Fortran, Cobol probably still have more programmers out there than Common Lisp has :)
Fortran 2008 is VERY different from FORTRAN 77.
I would also say Python 2 has "faded" or started to.
Faded doesn't mean it isn't used anymore. It mean it's retreated into a niche, and is no longer on the short list for new development, and no longer interesting to most developers.