2 bool optional params

Manfred_Nowak svv1999 at hotmail.com
Wed Nov 10 13:54:19 PST 2010


Jonathan M Davis wrote:

> Whether they are actually worth having, I really can't say.

They are not worth it.

Without optional parameters it is already dificult enough to remember for 
each name of a function the length of the formal parameter list and the 
sequence of types and meanings for each formal parameter. This are at 
least two dimensions.

Optional parameters add a second such sequence or a third dimension _and_ 
a fourth dimension: the sequence of the default values.

Named parameters add a fifth dimension and in addition this fifth 
dimension is to be exported if it should be usefull. Once exported and 
used it becomes unchangeable.

On evaluating an actual parameter list, every opening paratheses also 
opens a further local name space, which vanishes only if the according 
closing paranthesis is reached.

Human brains are currently not able to cope with complex hierarchies of 
more than ten chunks and probably they will never be able to do so. This 
restricts the usability of named parameters to such easy cases like the 
OP used: two or three named parameters and no function calls as actual 
parameters.

-manfred 

     



More information about the Digitalmars-d-learn mailing list