|
Boost : |
Subject: Re: [boost] Request for Interest in eval
From: Christian Hoermann (0oo0oo0.c_at_[hidden])
Date: 2008-09-21 02:27:56
> I can't see the benefits or advantage of it, what calling c++ functions in
> this way?
The advantage is essentially that some part of your code does not need
to be compiled.
The eval function is as similar as possible to its equivalent in
interpreted languages,
with the main difference being that you have to briefly mention the
name of functions you
want to use from within the script (in an eval header).
For example, one use case may be a template library (i.e. textual
templates). So, you might
wish to have a generic html template, which refers to a Person's first
name, last name, age
and so on. In your compiled code, you might have a Person class to
store this information.
Normally, you'd have to pass in all the details individually (or in some special
aggregated class/struct depending on the template library used) as far
as I know.
With the foundations provided by this library, you can pass in a
Person instance;
the actual Person class would remain completly unmodified as well.
Now, you could easily
change the templates without recompilation. Furthermore, if your eval
header includes
most of the functions in your Person class, the compiled code doesn't
have to worry
about what it passes to the template (i.e. the template can pull the
age, or the name,
as needed).
Christian
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk