Default Argument Improvements?

Whyn Oop whyn at
Thu Feb 1 05:39:04 PST 2007

Brian Byrne Wrote:
> I'm sure the reason is probably trivial and I overlooked it. :)

The reason might be as trivial as run time complexity: I assume that such
improvements would bring the compiler at least much closer to the class
of problems, which are believed to not be solvable in polynomial runtime.

This in turn would largely disable any maintainabilty.

Please note, that currently every defaulted parameter actually  is a
shorthand, which frees the coder from the work of writing one more

Allowing defaulted parameters everywhere would free the coder from writing about half of the otherwise required signatures for each of those parameters.

These further request can be forseen:
- not beeing forced to assign to the i-th defaulted parameter by mentioning all previous defined deafulted parameters. I.e. something like:
  f( f.default[9]=2)
instead of
  f( int, int ,int , int ,real, int,double, float, char, 2)
- not being forced to know the exact position of a defaulted parameter by naming them explicitely. I.e. something like
  f( f.default.x=2)
instead of
  f( f.default[9]=2)
- ...


More information about the Digitalmars-d-learn mailing list