[Ecls-list] Announce: A new C++ based implementation of Common Lisp based on the ECL CL code

Juan Jose Garcia-Ripoll juanjose.garciaripoll at gmail.com
Tue Mar 5 22:41:44 UTC 2013


On Tue, Mar 5, 2013 at 7:15 PM, Christian Schafmeister <
chris.schaf at verizon.net> wrote:

> C++ template programming is not pretty but using template programming
> hands the problem of identifying C++ types and parsing C++ code to the C++
> compiler where it is done properly. The other approach is to create
> something like SWIG, which attempts to parse C (it does a good job) and C++
> (it does a lousy job) and then generate interface code.
>

I did not mean to complain about the template approach in general, but I
just read the Boost code and it is awful. Sure, recursive file inclusion is
neat, but it is unreadable, as much as the rest of the code. The idea of
automatic coercion from various types to Common Lisp and back, though, is
neat.

"Can be ported" - certainly. These are Turing complete languages and we can
> do anything computable within them. It's a question of how much time
> porting requires.
>

Not much, I would believe. All common lisp have one or more functions to
allocate foreign objects; surely they also do have functions for defining
functions to be called or, if not, they can be implemented in two lines of
CFFI. One can implement the template approach with a lot of boilerplate and
a hundred lines of backend, I believe.


> But there is a reason no one has done this (interfaced the more
> complicated language features of C++ and CL) before.
> There is also a reason why SWIG exists and why boost::python exists.
> I've taken the boost::python approach to interfacing C++ to CL - this has
> not been done before.
>

Not that I ever heard of.


> Using my (boost::python-like) approach C++ classes have either single or
> multiple inheritance, the inheritance structure is duplicated in CL.
> Methods are exposed once with one name, in the lowest level class that
> implements them and they are inherited by every class that derives from
> that class.
>

I assume that each method is exposed only once, am I wrong. I am thinking on

class A {
  int method() const;
};

class B {
  int method() const;
};

How do you handle this? I know the phython approach relies on the
overloading that is inherent to Python's object system, but in Common Lisp
it gets tricky unless you resort to CLOS.

Best,

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130305/59577818/attachment.html>


More information about the ecl-devel mailing list