Re: lambda-like expressions for C



Paul Davis wrote:

your original email included something like this:

   lambda ("some C expression")

i interpreted the quotes as significant. sorry if that led me to
under-estimate your understanding of what you were asking.

Ah - that explains a lot; this is a quote from the OP, not me. I replied because his problem sounds interesting and I think it's valid, and it's similar to problems that I also have.

> lambda ("some C expression")

As it happens, I did consider putting the relevant expressions in quotes for my own code, and then parsing the string during my 'deferred evaluation' at runtime. This is convenient and the parsing is easy (at least if only limited expressions are allowed), but I don't currently think that this is a good idea. The main problems are that there's obviously no static compiler checking of the contents of the string, leading to run-time rather than compile-time failures (very bad in my application), and, secondly, that you can't easily cross-reference the string "wibble" to the object 'wibble'. However, the quoting appraoch does have significant benefits - for example, you can have expressions which include only built-in types, which you can't do if you're relying on overloading.

i prefer SigC++, which does the same thing and is very slightly more
powerful. it might do that kind of thing you mean, in that you can
wrap up a function call plus any number of arguments (of any type),
and it will generate a closure for you that can be "executed" later:

this sounds very interesting; I'll look it up. Thanks.

Evan




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