
Clasp 0.4 – Joining Common Lisp and C++ - mkeeter
https://drmeister.wordpress.com/2015/11/20/clasp-0-4-joining-common-lisp-and-cxx/
======
elcritch
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.

~~~
drmeister
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.

------
drmeister
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.

------
jlarocco
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...](https://github.com/drmeister/clasp/blob/master/src/clbind/class_registry.cc),
where there's a copyright notice, and then immediately below it an older
copyright notice to somebody else.

~~~
drmeister
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.

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

------
thrownunder
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.

~~~
drmeister
There are several. In Clasp there is
[https://github.com/drmeister/clasp/blob/master/src/asttoolin...](https://github.com/drmeister/clasp/blob/master/src/asttooling/astExpose.cc#L1076)
\- that exposes the entire Clang AST class hierarchy. Then there is
[https://github.com/drmeister/demo-clasp-
cxx](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](https://github.com/clasp-developers/clasp-sfml)

------
edwintorok
There is already a Clasp in Debian, but its something else:
[https://packages.debian.org/sid/clasp](https://packages.debian.org/sid/clasp)

~~~
Flow
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.

~~~
zuzun
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.

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

[http://www.cs.cmu.edu/Groups/AI/util/lang/lisp/code/math/cla...](http://www.cs.cmu.edu/Groups/AI/util/lang/lisp/code/math/clasp/0.html)

'Common Lisp Analytical Statistics Package'

Early 90s...

Or a simulator for electronic circuits in Common Lisp:

[https://doaj.org/article/6a656a29acba4a748a65f20bff63721b](https://doaj.org/article/6a656a29acba4a748a65f20bff63721b)

Or a production system from 1991:

[http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=7...](http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=79709)

Or a reasoning engine in Lisp:

[http://www.researchgate.net/publication/221393440_Towards_th...](http://www.researchgate.net/publication/221393440_Towards_the_Systematic_Development_of_Description_Logic_Reasoners_CLASP_Reconstructed)

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

