Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Compiler warning.

--- (edit)

The example, while being possible, looks quite improbable.

If it is only a matters of conflicting names, qualified names should be able to resolve the ambiguity; here I suppose you imagine implementing the same interface for the same type differently in two packages.

That a package implements an interface for the same external method for a third-party type is already dubious. Now, you have two packages like this and you want to import them both. That's quite a corner case.

Practically, the last package that is imported could "win" (so you can decide which you want). The compiler has to register all the possible implementations anyway, so a warning is trivial to emit on redefinitions.

----

I'd guess the restriction is to allow compilation of dynamic dispatch on a package basis (think separate compilation) instead of waiting till all possible files have been processed.



I mean dispatch in general, not necessarily dynamic dispatch.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: