Boost logo

Boost :

Subject: Re: [boost] Rave for proposed Boost.Local (functions)
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-02-05 15:16:06

On 2/5/11 9:48 PM, Joel de Guzman wrote:
> On 2/5/11 9:05 PM, Mathias Gaunard wrote:
>> On 05/02/2011 13:42, Joel de Guzman wrote:
>>> I think his argument is that with lambda expressions, the code is
>>> at the call site. However, I'd also argue that for more complex
>>> code spanning several statements, it is good practice to refactor
>>> them into their own functions. Overly complex lambda functions are
>>> a poor form.
>> So Boost.Phoenix self-acknowledges that it can only be used to write
>> trivial things?
> What are you saying? Did I say that? You must be confused because
> phoenix is not just about inline lambda functions, you know. There's
> also phoenix function, remember?
>> In functional programming, there is no difference between defining
>> lambdas and functions (except the former cannot be recursive), and it is
>> not viewed as bad practice to have functions spanning a couple hundred
>> lines.
> Sure! But so what's your point?

Limiting the discussion to C++, show me a function spanning a couple hundred
lines and I'll show you ways to refactor the code into smaller functions
and make the code more readable and maintainable. Overly complex functions
are a poor form! More so for lambda functions because they add clutter to
the enclosing function. Imagine:

     std::for_each(f, l,

        ...some 100 lines of code here

Eeeeww! Yuck! I'll give the one who wrote that a rotten egg as an award!


Joel de Guzman

Boost list run by bdawes at, gregod at, cpdaniel at, john at