Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-04-13 02:01:53


Joel de Guzman wrote:
> No it's not the library's fault. What I was just trying to say is that the
> interface should not be driven by the implementation. "Simple is
> beautiful. Keep it simple but not simpler." That has always been the
> mantra of design in general. Peter and Andrei's count_if versions
> side by side with MPL's count_if version *seem* to indicate (OK,
> arguably) that MPL's interface is more complicated due *in part*
> (Ok, not in whole) to compiler deficiencies.

But Peter's version is pretty much how MPL's 'count_if' implementation might
have looked like if two conditions were held:

1) all the compilers were fully standard compliant;
2) it is acceptable to compromise the compile-time efficiency to arguable
"simplicity";

MPL does not force you to implement everything in terms of 'fold', just
encourages :). If you, while authoring your own algorithm, are ready to
ignore the first issue and accept the second one, you are free to do it.
It's just that the library itself doesn't have such freedom.

> > Are you familiar with functional programming?
>
> What's the point of this question? To gauge my level of competence
> to form an opinion?

No, not at all. I just didn't want to reveal the second question before you
answer the first one :). The argument about "simplicity" of
pattern-matching-self-recursive-partial-specialized 'count_if'
implementation is partially built around the assumption that it's easy to
understand for somebody with functional programming background. To me,
functional programming primitives like 'fold' et al. seem much more
important concepts than any esoteric low-level patterns matching.

Aleksey


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