I think that D should be consistent with rules of types derivation, in particular the pointer one. Two pointer types should be same if and only if types they pointer are the same. Breaking this rule would result in language complexity.

In case when default arguments are part of the type, default arguments must be written in declaration of a function pointer, moreover function pointers with different default arguments would be different types. So, besides of getting convenient usage of a shorter function call a user would have carry a particular default value with every declaration/definition he writes. Also similar functions pointers with different default arguments would not be interchangeable because they are different types. I think that such constraints would make the proposal a net loss to D contribution.

Also, making default arguments a part of a definition would break C/C++ legacy rules which claim that a function is characterized by its return value and number, order and types of its parameters. Although, it not necessarily mean that this rule cannot be broken, but it at least requires strong reasons, however as it is discussed, the proposal would result in a unclear usage, increased language complexity, subtle bugs and implementation issues.

Reply via email to