Import conflict resoultion

kris foo at bar.com
Wed Jul 12 20:01:06 PDT 2006


Suspect we've already flogged this to death a number of times, but 
selective-imports don't appear to give you much functional power above 
and beyond the prefix-import. Thus it would be entirely optional, IMO. I 
know Dave has noted this in a prior post, as have others.

Dave wrote:
> Given your rational and proposal, the _need_ for "specific symbol 
> import" functionality will probably disappear too, keeping the language 
> that much simpler to implement and less to learn and remember in order 
> to maintain code.
> 
> import a.popular.db.lib dblib;
> alias dblib.open dbopen;
> alias dblib.close dbclose;
> 
> would be used instead of something like:
> 
> import a.popular.db.lib dblib
> {
> open dbopen;
> close dbclose;
> }
> 
> Not much difference in lines of code or effort to write or scan, the one 
> advantage being that it would tend to keep aliased symbols close to the 
> import (that's still a big advantage though, IMHO).

egad! :)

Would perhaps be simpler to avoid that, and just do this instead:

import a.popular.db.lib db;

db.open ();
db.close ();

As well as being concise and safe, it also clearly indicates just which 
instance of open/close is being invoked. Those who don't need safe 
imports can still happily use the existing variety:

import a.popular.lib;

open();
close();



More information about the Digitalmars-d mailing list