Module visibility feature?
Jeremy DeHaan
dehaan.jeremiah at gmail.com
Fri Jul 19 09:50:11 PDT 2013
On Thursday, 18 July 2013 at 10:55:39 UTC, Dicebot wrote:
> On Wednesday, 17 July 2013 at 11:33:39 UTC, Jeremy DeHaan wrote:
>> So I was reading this:
>> http://wiki.dlang.org/Access_specifiers_and_visibility
>> ...
>
> How will it be any different from
>
> module foo.barstuff;
>
> package:
>
> // declarations
This is how I handle this situation currently, and was actually
part of the inspiration for this idea. Like Tommi said, it makes
a very clear distinction between what the user should and
shouldn't be able to interact with.
A regular module can still be imported, even though everything it
would contain has package visibility. Trying to import a package
module and getting an error because of it is like having the
compiler say, "There's nothing in here for you!"
Also, having a way to specify that a module isn't publicly
visible could be used for code completion features in IDE's. If
foo.barstuff is a package module, typing "import foo." would show
"foo.bar" as the onlyoption for modules they can import.
More information about the Digitalmars-d
mailing list