On Mon, Oct 13, 2003 at 10:00:10AM +0200, Lars Gullik Bjønnes wrote:
> | with FuncResult being
> >
> |     struct FuncResult {
> |             dispatch_result res;
> |             idx_type idx;
> |             pos_type pos;
> |     };
> 
> Are you sure that no dispatch ever uses the idx and pos passed in?

Sure they do. Tab in a math array sort of increments the index.

> | The reason is that we'd most likely have to add a third item soonish to
> | model 'Parlist/Paragraph/Position' of InsetTabular and I do not want to
> | touch all headers again. And it is less clutter...
> 
> I have no problem with that, so ask me to do it when the time arises.

But I have.

Perhaps bad memories regarding Fortran subroutines taking 37 arguments
and compilers not complaining if only 36 have been passed...

> I'l continue to do monotonic improvements anyway.
> (The return of FuncResult f.ex., which actually fit rather well with
> my plans for dispatch.)

I'd pretty much prefer the modifiable reference as the resulting code is
much shorter. 

Compare

        void dispatch(FuncRequest & cmd)
        {
                ++cmd.idx;
                cmd.result = DISPATCHED;
        }


with

        FuncResult dispatch(FuncRequest const & cmd)
        {
                FuncResult res;
                res.pos = cmd.pos;
                res.idx = cmd.idx + 1;
                res.result = DISPATCHED;
                return res;
        }

and not that the first version will work even if other parameters are
added. [And there are two more benefits I won't mention]

Andre'

Reply via email to