www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Partially qualified names

reply "Peter Alexander" <peter.alexander.au gmail.com> writes:
Suppose I have some long symbol name:

foo.bar.baz.quux;

I can refer to it as simply quux if the name is unambiguous, but 
when there is an ambiguity I have to refer to it by its full 
name, foo.bar.baz.quux, which can be frustrating for long names.

It would be nice if I could refer to it by partially qualifying 
the name, e.g. baz.quux or bar.baz.quux. Of course, the partial 
qualification itself would need to be unambiguous.

Is there any reason this couldn't be done, or should I file an 
enhancement request?
Jun 01 2013
parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday, June 01, 2013 23:13:36 Peter Alexander wrote:
 Suppose I have some long symbol name:
 
 foo.bar.baz.quux;
 
 I can refer to it as simply quux if the name is unambiguous, but
 when there is an ambiguity I have to refer to it by its full
 name, foo.bar.baz.quux, which can be frustrating for long names.
 
 It would be nice if I could refer to it by partially qualifying
 the name, e.g. baz.quux or bar.baz.quux. Of course, the partial
 qualification itself would need to be unambiguous.
 
 Is there any reason this couldn't be done, or should I file an
 enhancement request?
Even if the compiler could figure it out, I'd be very afraid that the fact that the programmer can no longer look at baz.quux and know that baz was a base package would cause problems. It would also create yet another way for code to be broken when new symbols are added. Really, this is one of the things that aliases are for. - Jonathan M Davis
Jun 01 2013