public import and bugs it causes

Simen kjaeraas simen.kjaras at
Fri May 14 13:53:13 PDT 2010

Alex Makhotin <alex at> wrote:

> I think this is a bad design of the language.
> Global variables are bad things.
> C# doesn't have them.
> In this sense I like C# which prohibits any fields or methods in  
> namespaces.

Gods, I hate that. I like to restrict bondage to my bedroom,
thank you very much.

This is one of the reasons I try to avoid C#/Java when I can.
There are functions that do not belong in a silly namespace, and
there should be ways to define those.

> But I also can evade by using explicit 'public import'. This leads to  
> bugs.

At the same time, if one module should be a superset of
another, public import is the right way to do just that.
If one has to provide aliases to everything in the submodule,
a lot of work goes to waste, and one must keep the modules

In short: Public imports have their place, but don't use them
if there's no need. (like with just about everything else)


More information about the Digitalmars-d mailing list