Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Clasp 0.4 – Joining Common Lisp and C++ (drmeister.wordpress.com)
73 points by mkeeter on Nov 21, 2015 | hide | past | favorite | 17 comments


Fascinating project! I kind of hope to need to work on C++ sometime so I can try it out. Particularly the Clang AST library would be a enormous boon for any LLVM / C++ / C work. IMHO, 9/10's of any compiler work is just figuring out how to write recursive functions to modify the AST which is a pain using C++ and visitor patterns. Working in LISP for these parts while being integrated with C++ for other parts sounds like it would be awesome if not outright fun.


Thanks - yes it's fun and very powerful. An integral part of Clasp is "clasp-analyzer" - a static analyzer that uses the ASTMatcher library to analyze all of the Clasp C++ source code (>170 source files). It builds an interface to the Memory Pool System garbage collector (coming soon) and builds a fast replacement for dynamic_cast. We are planning to use it to write a "super-swig" that could automatically build foreign function interfaces for C++ code.


Announcing Clasp 0.4 – a new release that incorporates a brand new compiler – capable of generating 200x faster code than previously, many bug fixes, a more complete Common Lisp implementation, and improved C++ interoperation.


Is there some sample code for the C++ interface? It is a good idea but I am curious how much headers and templates complicate things.


There are several. In Clasp there is https://github.com/drmeister/clasp/blob/master/src/asttoolin... - that exposes the entire Clang AST class hierarchy. Then there is https://github.com/drmeister/demo-clasp-cxx - it exposes a small "Hello World" example. Then there is the SFML library that is being exposed by flash- one of the regulars in the #clasp IRC channel: https://github.com/clasp-developers/clasp-sfml


There is already a Clasp in Debian, but its something else: https://packages.debian.org/sid/clasp


Same with Homebrew.

    $ brew info clasp
    clasp: stable 3.1.3 (bottled)
    Answer set solver for (extended) normal logic programs
    http://potassco.sourceforge.net/
Would be great to rename this recipe to potassco instead.


No, it wouldn't. The program is called clasp. Renaming it to potassco is like renaming Microsoft Excel to Microsoft Office. It's also years older than the LISP clasp. And finally, the program is an amazing piece of technology and state-of-the-art in its scientific field.


There are already several other Lisp projects called CLASP ;-) : For example...

http://www.cs.cmu.edu/Groups/AI/util/lang/lisp/code/math/cla...

'Common Lisp Analytical Statistics Package'

Early 90s...

Or a simulator for electronic circuits in Common Lisp:

https://doaj.org/article/6a656a29acba4a748a65f20bff63721b

Or a production system from 1991:

http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=7...

Or a reasoning engine in Lisp:

http://www.researchgate.net/publication/221393440_Towards_th...


Since they invented capital letters already, they do spell differently! The debian package is "clasp", not "Clasp".


Uppercase letters are not permitted in Debian package names according to the policy: https://www.debian.org/doc/debian-policy/ch-controlfields.ht...


I think for naming purposes we should go with "cclasp" as the name.


I hate to be negative, but that code base is a complete mess. I looked into helping out on the project a few months ago, but stopped almost immediately when I saw the code. I'm a little sad that a release is being announced and the code is still a mess.

For example, in the src/core directory there are about a million files, of types .txt, .cc, .cxml, .xml, .old, .py, .sh, .prototype, .csc, .pdb, .moe, .grep, *.fbp, etc., and many of them have mysterious names like "tf.csc" or "v.txt". And a lot of the files seem to have nothing to do with common lisp or C++, and contain mysterious 1 or 2 line code snippets or shell one liners.

Honestly, it's just a terrible first impression. Are there any plans to clean it up and make it usable by other people?

Edit: And perhaps more worrying, there are things like this https://github.com/drmeister/clasp/blob/master/src/clbind/cl..., where there's a copyright notice, and then immediately below it an older copyright notice to somebody else.


The code base being a mess is a known problem. There's an issue open for the next release to get rid of all those useless files ([1]). The code has also recently been passed through clang-format, and in general the quality of the codebase appears to be improving as the number of people contributing to it is slowly increasing.

A file having multiple copyright notices is actually common practice. It indicates that the code is based on older code, the copyright of which of course belongs to the original author, but that it has been significantly modified by the "new" author.

I think it's important to note that up until recently this was basically a one-man project. It's in the early stages still. drmeister has since gotten some serious help organizing the project, which should (and looking at the issue tracker, I think it will) help a lot to keep the project moving forward in the right direction.

The 0.4 release seems to mark a point at which Clasp is usable and major issues with its functionality have been resolved. It's not in any way "finished".

If you want to contribute or are just interested in the project I'd suggest joining #clasp on Freenode (as I did a couple of months ago). The channel is pretty active.

[1]: https://github.com/drmeister/clasp/issues/41


Yes - I have a plan to clean it up. Clasp exposes the clang source to source translation library. Now that it's fast I'm going to automatically refactor the whole thing in one go.


So you can do this without using >4GB of ram per source file now?


Ah, the converse of Greenspan's tenth rule in action. (https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: