How about Go's... error on unused imports?

Leandro Lucarella llucax at gmail.com
Sat Nov 14 16:12:19 PST 2009


Walter Bright, el 14 de noviembre a las 14:59 me escribiste:
> Leandro Lucarella wrote:
> >Walter Bright, el 14 de noviembre a las 10:36 me escribiste:
> >>Leandro Lucarella wrote:
> >>>Does this makes more sense?
> >>Yes.
> >
> >It would be pushing to much to ask if you're willing to give it a serious
> >thought then? =)
> 
> I understand it (I think), but I'm not as keen on it as you are <g>.
> 
> Consider that D has function hijacking protection (I think this is
> unique to D) so that inadvertent overloading by the same names in
> different imports is virtually eliminated. So I think the marginal
> benefit of the proposed changes is small.

I can see that it would be too much trouble for too little gain (from you
POV, I still think that readability is key for code-review, which
I consider key for high-quality code).

Can you at least consider making easier for people who consider this is
an important feature? What I think it would do a big difference is some
syntax sugar for this:

import leaf = some.large.package.leaf;

Making static imports have that semantic can be an option, but it could be
bad for backward compatibility. Maybe final import?

final import some.large.package.leaf;
leaf.f();

This way I can easily put all my imports inside a final block:

final {
import foo.bar;
import bar.baz;
}

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
CHINO ATRAPA COTORRAS
	-- Crónica TV



More information about the Digitalmars-d mailing list