Boost logo

Boost :

From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-11-17 04:10:31


Gennadiy Rozental wrote:
> "Daniel Wallin" <dalwan01_at_[hidden]> wrote in message
> news:cne6k4$dpl$1_at_sea.gmane.org...
>
>>Gennadiy Rozental wrote:
>>[snip]
>>
>>>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. Furthermore, you
have O(N) instantiations for every lookup, we have O(1). Actually you
seem to have an mpl::find_if<> instantiation for every one of those, so
make that O(N^2).

Preprocessed for GCC, the library is 580 lines of code. If you don't
need some of the features we have, why don't you just not use those
features instead of rolling your own version of the library? Is parsing
400 lines really a big deal?

>>>I do not see to many differences from your solution. You also need
>
> unique id
>
>>>for the keyword, which you then organize in ordered structure. So
>>>essentially getting the same result.
>>
>>But the type should never be part of the keyword!
>
>
> Well, I strongly disagree here.

Fine.

>>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.

>>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);

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

-- 
Daniel Wallin

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