import concerns (was Re: Historical language survey)

Tydr Schnubbis fake at address.dude
Sun Jul 9 20:08:04 PDT 2006


Derek Parnell wrote:
>> The point is you can list multiple names from the module without  
>> repeating the module name:
>>
>> import MyModule with foo, baz;
>>
>> And "with" is already a keyword.
> 
> So what? But if you did want to reuse the "with" keyword why not use it in  
> the same manner...
> 
>   with MyModule import foo, baz;
> 

This is starting to look a lot like Python syntax:

from MyModule import foo, baz
from MyModule import veryLongName as vln


If you use the simple syntax in Python, you need to fully qualify names 
when you use them:

import MyModule

MyModule.baz


You can also import all names into the current namespace:

from MyModule import *


Or alias:

import MyModule as MM


Would have been great to have all this control and flexibility in D.


Or instead of 'with', does using 'scope' make sense?

import scope MyModule foo, baz



More information about the Digitalmars-d mailing list