|
Boost : |
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-02 13:32:13
AMDG
>> For me, the only advantage of runtime access is to be easier to use
>> inside the library algorithms. As the writer of a library is not here
>> to facilitate his own life but the user's life, this kind of advantage
>> shouldn't be taken into account if it's the only one.
>>
>
> The reason for parameterizing such concepts as orientation and direction
> in the library is not for the library author's convenience, but for the
> user. We typically see code that looks like this coming from the
> average programmer:
>
> if(layer % 2) {
> ...150 lines of application code that look like
> do_something(point.x() + value);
> ...
> } else {
> ...150 lines of near identical application code that look like
> do_something(point.y() + value);
> ...
> }
>
To the extent possible, the library should rely only on compile time
accessors, IMO.
This does not preclude having the points also provide runtime accessors
for users.
It might work to allow either compile time access or runtime access and
if either one
is not given, fall back to implementing it in terms of the other.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk