[Issue 5005] Remove restrictions on module/package with same name.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 7 07:44:40 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5005



--- Comment #5 from Austin Hastings <ah08010-d at yahoo.com> 2010-10-07 07:44:01 PDT ---
Nick,

Your understanding is correct. I want to be able to hide the implementation of
the module/package from users of the module/package, by keeping the same name.

Your suggestion, however, fails in real life. The problem with the _impl
approach (which is *exactly* - down to the spelling - what I tried first) is
that it fails for any kind of complex structure, where more than one _impl is
required.

==== example ====
lib.mylib.sublib.foo

becomes

lib.mylib_impl.sublib_impl.foo

and has to import

lib.mylib_impl.something

and 

lib.mylib_impl.sublib_impl.otherthing

==========

The approach suggested by bearophile is (pardon the pun) bearable, since it
permits the internal parts to maintain their correct names at the cost of
having to change the caller code.

This is the "worse" solution in terms of making the use of the library opaque,
but the "better" solution in terms of making it possible to manipulate the
source code with a "dumb" script: 

perl -pi.bak -e "s/lib.mylib;/lib.mylib.all;/" $file

(The fact that I have to manipulate the code with a dumb shell script is
evidence to me of why this is a good enhancement. :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list