nested module problem

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Oct 28 23:35:33 UTC 2020


On Wed, Oct 28, 2020 at 10:52:33PM +0000, Adam D. Ruppe via Digitalmars-d-learn wrote:
> On Wednesday, 28 October 2020 at 22:43:12 UTC, mw wrote:
> > I wonder what's the best way to resolve this conflict, i.e my local
> > file name with 3rd party library dir name.
> 
> Don't write any module with a single name unless you are guaranteed to
> never import it.
> 
> pyd should have called it like `module pyd.util;`
> 
> Then you call yours like `module mw.util;`
> 
> This makes such conflicts a lot less likely.

IMO, 3rd party libraries should always be in their own package
namespace. Leave the top-level for user code! Why should a local module
'util' conflict with any dependency?  It should be the library author's
job to make sure his code doesn't conflict with the user's!


T

-- 
Recently, our IT department hired a bug-fix engineer. He used to work for Volkswagen.


More information about the Digitalmars-d-learn mailing list