Boost logo

Boost :

From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-01-13 10:48:18


----- Original Message -----
From: "Jonathan Turkanis" <technews_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, January 13, 2005 1:40 AM
Subject: [boost] Re: Functions as Filters (was Program Reuse...)

> Bob Bell wrote:
>
>> quoted here is really quite minor. The second thing that's apparent
>> is that your ToUpper relies on global variables, whereas
>> toupper_filter relies on function arguments, which in my mind is a
>> more heavily-weighted concern than the complexity difference. My
>> question is why you do you think relying on globals is a better
>> approach? Some of your points have been motivated by the needs of
>> novice C++ programmers; do you really think it is better to advocate
>> a programming style that relies on global variables?

Reading and writing to cin and cout, is a long established effective
practice which results in generic and easily reused code. I am not simply
advocating for needs of novice programmers. I am not a novice, but I always
want my code to be written as if for novices whereever possible. It is my
experience that when writing as if for novices usually results in code which
is more easy to maintain, reuse and document.

> I was going to mention the global variables, but in fairness I think the
> four
> global streams have special status. If I could redesign the standard
> iostreams
> library without concern for backward compatibility, I'd change a number of
> things but I'm not sure I'd require users to write
>
> std::cout::instance() << "Hello World!\n";
>
> I'm interested to know exactly what Christopher thinks is too complex
> about the
> filter concepts, since I'm sure others will share his view.

I don't think they are too complicated! They do precisely what they should
do, the way they should do it. I don't think that the filter concepts can
and should be simplified any further. I however want the alternative option
to use a void function which operate on cin and cout, as a filter when it is
appropriate.

CD


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