Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2004-11-17 21:46:11


> >>>Yeah. In this case keyword "value" couldn't be typed. Ok. I slightly
> >>>reworked my code see attached. Now it supports both typed and non-typed
> >>>keywords. all in 120 lines (I am sure it could be made smaller by more
> >>>effective mpl use).
> >>
> >>It's only 120 (instead of 800) lines because you haven't implemented the
> >>features and workarounds that our library has. It's not like we've
> >>written ~600 lines of useless code that can just be eliminated..
> >
> >
> > My code works without *any* modifications on:
> >
> > gcc 2.95.3
> > gcc 3.2.3
> > gcc 3.4.2
> > borland 5.6.4
> > cw 8.3
> > vc7.1(+/-stlport)
> > vc6.5 (well this guy does require to change typename to
> > BOOST_DEDUCED_TYPENAME in couple places, but that's it)
>
> Again, you are lacking almost every feature we support.

Let's not make populist statements. I prefer discussion based on simple
examples. "Here is what my solution can do, but you can't; Here is an
interface I provide, here is what you do" e.t.c.

In my opinion my solution only lacks some kind of default value support.
While provide notion of typed keyword.

> Furthermore, you
> have O(N) instantiations for every lookup, we have O(1).

I do not understand your code that well to contradict you, but I frankly
very much doubt so.

> Actually you
> seem to have an mpl::find_if<> instantiation for every one of those, so
> make that O(N^2).

I use mpl algorithm to speed up delepoment. I may've use my own list
implementation, as you do. And I don't expect it to see signifant diffence
in both complexity and performance.

> >>It has to be coupled with the function.
> >
> > ?
>
> The argument type requirements of a function is best coupled with the
> function, not the argument identifier.

I consider keyword as a part of function interface and not a standalone
thing. keyword name could designate: object identifier, object property, IP
service string and many other things. Why would I ever want to invent global
shared name keyword and used it anytime I want parameter name amoung my
function parameters??

> >>Keywords needs to be reusable between different functions.
> >
> >
> > Why would I want this: In one place parameter abc is string in another
is
> > float? IMO it's very rarely make sence and I would use non-typed keyword
in
> > this case. In majority of the usage cases I would use typed one though.
>
> Are you saying argument names are in general picked to unambiguously
> reflect their type?
>
> void f(float size);
> void g(vec2d size);

how f size parameter is related to g size? I would call one 'length' and
second area.

> Who decides if 'size' is non-typed or not?
You are. If you believe that these two functions are related as well as
their parameters you may name them the same and share the keyword. It may
happend that actual data type is different (or template parameter), then you
would use typeless keyword:

class A
{
    A( std::string name, ... )
    A( char const* name, ... )
    A( const_string name, ... )

    template<Params>
    A( Params const& ) ...
};

new A( name = "abd" );
new A( name = std::string() );
new A( name = const_string() );

> Who decides if 'size' has a
> default value, or is a required parameter? (I know your code doesn't
> support that, but still..).

I am not sure I understand what is you point here. All 'questions' have an
answer - you - library user.

> --
> Daniel Wallin

Gennadiy.


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