Boost logo

Boost :

Subject: Re: [boost] Request for Interest in eval
From: Christian Hoermann (0oo0oo0.c_at_[hidden])
Date: 2008-09-21 20:57:14


> Have you tried boost.python ? Also, you may want to read
> http://www.boostpro.com/writing/bpl.html, as that seems
> exactly to be what you are aiming at.

No, I hadn't looked at this previously. But, you're right, the
embedding functionality of Boost.Python seems to provide
the functionality of eval in Python syntax.

> As I see it the main advantage would be c++ like syntax

Seems like this the common request, so I'll think about
changing the syntax (the parser is only a small part part
of the library).

Currently the library is dynamically typed, seemingly
like Boost.Python. So, each time you call a script, different
methods/functions might execute, depending on the
arguments. It should be possible to use C++ like syntax
instead; however, this would of course mean that the code
would be statically typed.

Also, whilst it might be possible to get mostly C++ like
syntax, there would always be limitations. For example,
the library could never instantiate "new" templates; e.g
if you want a vector<int>, you'd have to register it, unless
a polymorphic system like Java Generics were used
instead (which can likely only work for simple C++
template classes).

> There may be some use for it if was lightweight
> and easily integrated

Well, it's currently header only and non-intrusive; so
relatively easy to incorporate. However, it's probably
not that lightweight in terms of compile time, run time
and executable size.

> Could this eval be used, somehow, to help solve the
> problem mentioned

I don't think so, sorry. Boost.Spirit really needs to
instantiate many "new" templates, afaik. I don't think it's
possible to instantiate these templates from within the
script (since it actually requires compiled code generation),
unless you mention them all beforehand in the compiled
program, which is probably impossible in this case.

Christian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk