Re: lambda-like expressions for C



On Wed, 9 Apr 2003, Edward Peschko wrote:

> hey all,
>
> I was wondering if anybody knew of a lambda-like expression api for C... what I'm looking
> for is something like:
>
> int variable = 15;
> lambda ("if (_1 < 50) fprintf(stderr, \"HERE -- %d\", _1); ", variable);
>
> [...]
> what I'm ultimately looking for is the ability to take this string from a file
> (or other source), and reconfigure what the program is doing on the fly, without
> recompiling. Ultimately, I want to use this for debugging purposes - ie: being able
> to debug programs via configuration file without a debugger.
>
> Does anyone know an api like this/one that is available? If there isn't, would the glib
> team be interested in helping design one, and integrating it into glib?

The term `lambda-abstraction' is usually used to refer to something
different from what you want. A lambda abstraction is an anonymous function;
they abound in functional languages, but they are even in perl (see
perlsub's man page...)

What you want, I think, is an embedded/extension/etc language. C is probably
not very easy so use that way, I guess (It'd be `unilateral' in current DoD
lingo :). But if you can afford to use another language for that, there are
quite a few available: s-lang, python, gnu's guile, and i'm sure if you go
to http://directory.google.com/Top/Computers/Programming/Languages/ you'll
find quite a few more.

I doubt glib is the right place to add such a thing, tho.

-- m


-----------------------------------------------------------------------
Mariano Suarez Alvarez
Departamento de Matematica - Universidad Nacional de Rosario
Pellegrini 250 - Rosario 2000 - Argentina

    De la observacion de la irreductibilidad de las creencias ultimas
    he sacado la mayor leccion de mi vida. Aprendi a respetar las ideas
    ajenas, a detenerme ante el secreto de las conciencias, a entender
    antes de discutir, a discutir antes de condenar. Y como estoy en
    vena de confesiones, hago una mas, quizas superflua: detesto con
    toda mi alma a los fanaticos.

    Norberto Bobbio, Italia civil.

-----------------------------------------------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]