Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-01-11 00:06:59

christopher diggins wrote:
> ----- Original Message -----
> From: "Jonathan Turkanis" <technews_at_[hidden]>
>> christopher diggins wrote:
>>> ----- Original Message -----
>>> From: "Jonathan Turkanis" <technews_at_[hidden]>
>> I'm happy to add classes to make the library easier to use even if
>> efficiency is
>> sacrificed. one_step_filter is an example of this. I'm just looking
>> for an example where it would be easier to write a filter as above
>> than to use one of
>> the existing filters concepts.
> Writing, learning, understanding and reading concepts is hard for
> inexperienced (and some experienced) C++ programmers. I still get
> confused and frustrated when using them, and I am not completely wet
> behind the ears.

I agree with this. I'm happy to add features which make the library easier to

> It took me a couple of hours to figure out how to
> write that trivial extension to your library, despite the fact that
> the library and documentation is extremely well written.


>> Not conforming programs: main must return int. Also, you can't *use*
>> the main
>> function. E.g.,
>> void f()
>> {
>> return main(); // error.
>> }
> I realize that. I meant that many of these programs can easily have
> their guts placed in void functions.
> void DoWork() {
> // do work
> }
> int main() {
> DoWork();
> }

Okay, but do you really expect people to start writing programs this way? I
think people would only do this to conform to your filter concept. My question
is: why aren't the other concepts sufficient?

> By taking this one simple step, a person's code could then be easily
> reused. This does overlook the fact that most filter programs take
> parameters which is trivially remedied.

Note that none of the other concepts has this problem.

>>> The only reason to ever choose a over b or c, is simplicity and ease
>>> of use.
>> I understand that's what you're arguing, and it's a perfectly
>> acceptable justification. But I haven't seen an example yet.
> Consider the following program:

> int main() {
> char c;
> while (cin.get(c)) cout.put(toupper(c));
> return 0;
> }

> ...

I guess I should have asked for a *realistic* example. If you really write such
simple programs you don't have to worry about reuse; it's simpler to write the
whole program again from scratch.

>> The expression
>> filter1() | filter2() [A]
> Sorry, I thought it was a statement. Wouldn't it be useful to also
> allow one liners with a separate syntax:
> source() > filter1() > filter2() > sink();

As I mentioned in a previous message, I think this is a good idea, if it uses
the pipe notation. I don't see why a different operator should be used.


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