On Monday, 28 April 2014 at 19:32:10 UTC, Walter Bright wrote:
On 4/28/2014 4:29 AM, "Ola Fosheim Grøstad"
<[email protected]>" wrote:
No. Even though they are the same function as far as the
signatures are concerned, they are different functions as far
as the D type system is concerned, and hence the call is
ambiguous. You'll have to qualify by framework1.std.something()
or framework2.std.something().
So you have to choose between framework1 and 2's version if
std::string when building your own class, an then cast back and
forth between the different framework bindings even though the
actual type is the same? Isn't that tedious?
import.std();
… std.something(); // namespace encapsulation broken or fail?
… std.coolstuff();
No problem, std.d overrides because it is imported directly and
so std is in the current scope. The current scope overrides
imported scopes.
But I think that it is a problem that std.something is silently
rebound to a different function.
Still no problem. Qualifying it with framework2 says which one
you want.
The problem is that you are forced to qualify the D-binding
rather than the path of the cpp function. This will only work out
ok if different framework authors cooperate.
Right, but I want to be sure that the type-system sees all
externs with the same
signature as the same type.
Remember, a C++ signature is the same as its type in C++, but
that is not true of D.
And that makes it tedious to interact with C++?
But for what gain?