bearophile wrote:
D too copies the default value at the calling point. Looking at this from the
eyes of a Python programmer this looks like a dirty hack.

I don't see how it could be called a dirty hack.

This can be a cause of problems in D dlls too, I am not sure.

If you're designing a D dll, you have to decide what the interface actually is. Anything that appears in your .di interface file is part of the interface, and if you change that interface, you have to recompile all code that relies on it.

A default argument value is part of the interface.

Don't use default argument values if you don't want them to be part of the interface. They are trivially avoided:

    int foo(int i, int j = 7);

becomes:

    int foo(int i);
    int foo(int i, int j);

and in your implementation:

    int foo(int i) { return foo(i, y); }

Again, *anything* about the interface you expose will force recompilation of everything that uses that interface, if the interface changes in any way. D provides all the features necessary to support common and well understood techniques for implementation hiding and abstraction.

Reply via email to