Import proposals (Discuss)

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Tue Jul 11 18:15:21 PDT 2006


Derek Parnell wrote:
> On Wed, 12 Jul 2006 02:37:00 +0300, Jari-Matti Mäkelä wrote:
>> As a side note: I just installed dmd 0.162 and it seems imports have
>> been finally fixed. Now private imports and private members really are
>> private, yay! This means that private members are not accessible, but
>> they are visible to the unprivileged modules. Private imports are not
>> visible nor accessible. Yes, this is how it really should work. Even
>> diamond shaped import constructions work according to my simple test
>> suite. Simply excellent! Thank you Walter!
> 
> Almost anyway... 
> (1) FQN usage incorrectly overrides 'private'.
> 
Yeah, I noticed it after playing with imports for a while.
> 
> (2) The error message given when not using FQN is not very helpful.

No, but it finally works. A step in the right direction. ;)

> 
> Change the eee.d file to ...
>  // ---- eee.d ----
>  import bbb;
>  import ddd;
>  import std.stdio;
>  void main()
>  {
>     writefln("bar %s", bar());
>  }
> 
> And the compiler gives this message ...
> 
>  bbb.d(3): function bbb.bar conflicts with ddd.bar at ddd.d(3)
>  eee.d: module eee bbb.bar is private
> 
> The problems with this message are that it doesn't give the line number in
> eee.d that triggered the message, and that it exposes 'private' stuff to
> the coder.

Yeah, this is a bit funny one. :)

> A better message might be along the lines of ...
> 
>  eee.d(6): No accessible function 'bar' was found.

Yes. Personally I would also like to know possible matches to the
function call. Usually I start with everything as private as possible
and widen the visibility, when problems like this occur.

-- 
Jari-Matti



More information about the Digitalmars-d mailing list