On Fri, Mar 15, 2002 at 01:46:57PM +0100, Asger K. Alstrup Nielsen wrote:
> This stiffles change, because to introduce a new
> parameter requires changes all over the place.
> Therefore, most functional programming languages are
> introducing object orientation into their type systems.

If you have functions requiring a lot of parameters or if you are not sure
whether you need to change the signature soon you simply put all (or at
least the 'instable' args) in a structure and pass down a (possibly
const) reference to such a structure.

If you need another  int  to be passed, add it to the struct and recompile.
No need to edit everything.

Since usually most of the parameters are read-only this might even speed up
things because you pass only one argument instead of several on the stack.

Additionally, one can usually just forward-declare this parameter struct
in headers, which is especially nice if you have things like enums or
strings that usually can't be forward-declared.

Andre'

-- 
André Pönitz .............................................. [EMAIL PROTECTED]

Reply via email to