On Wednesday, 4 October 2017 at 17:56:16 UTC, Walter Bright wrote:
On 10/4/2017 2:28 AM, Dukc wrote:
But you can't deny our solution eats expressive power: If you don't want to change code you're importing, you have to write a wrapper type for int[] here.

Please present an example.

I think that was the point of Timon's example. If you have a module A that implements a range algorithm, a module B that defines a range-like type (but actually its member function not matching the exact signature of range primitives), you (module C) as user of modules A and B are not able to provide range primitive wrapper functions for the type defined in module B (which you can't modify). So you can't use A's range algorithm on type defined in B.

ADL solves this problem (adapting third-party libraries to your needs).

Since D's modules are closed (can't be extended from the outside like namespaces), if we want to support some form of ADL (the primary use-case being algorithm libraries), we would probably need to introduce some form of open for extension scopes like namespaces. Or change extern (C++, namespace) to behave like people coming from C++ may expect.

Reply via email to