www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - import alias

reply Simon Hobbs <Simon_member pathlink.com> writes:
Another idea nicked from C#. I often find that I want to make an alias for an
imported namespace and it would be convenient to do it in a single line of code.
E.g.

import SomeCompany.SomeLibrary.SomeClass = MyAlias;

instead of:

import SomeCompany.SomeLibrary.SomeClass;
alias SomeCompany.SomeLibrary.SomeClass MyAlias;

I'm very, very lazy :)

Si
Jul 11 2004
parent reply "C. Sauls" <ibisbasenji yahoo.com> writes:
I like the idea, but would prefer something more like...

import foo.bar.baz as fbz;

-Chris S.
-Invironz

Simon Hobbs wrote:
 Another idea nicked from C#. I often find that I want to make an alias for an
 imported namespace and it would be convenient to do it in a single line of
code.
 E.g.
 
 import SomeCompany.SomeLibrary.SomeClass = MyAlias;
 
 instead of:
 
 import SomeCompany.SomeLibrary.SomeClass;
 alias SomeCompany.SomeLibrary.SomeClass MyAlias;

Jul 11 2004
parent reply heretic <heretic_member pathlink.com> writes:
In article <ccrijv$176d$1 digitaldaemon.com>, C. Sauls says...
I like the idea, but would prefer something more like...

import foo.bar.baz as fbz;

Exactly. Just like Python does it :)
Jul 11 2004
parent "C. Sauls" <ibisbasenji yahoo.com> writes:
heretic wrote:
 Exactly. Just like Python does it :)

I'm still tempted to request 'from' too... could you imagine: from std.string import toString as toStr; from mango.io.FilePath import MutableFilePath as XPath; -Chris S. -Invironz
Jul 12 2004