Import concerns revisited

Derek Parnell derek at psych.ward
Sun Jul 9 04:14:03 PDT 2006


On Sun, 09 Jul 2006 19:52:15 +1000, Walter Bright  
<newshound at digitalmars.com> wrote:

> Ivan Senji wrote:
>> Sure I could use
>>  static import m2;
>> alias m2.func f2;
>>  And that would be an improvement but it is still longer (and arguably
>> less understandable) than:
>>  import m2.func as f2; ;) :)
>
> Let's say you're going to do more than one:
>
> static import m2;
> alias m2.func f2;
> alias m2.abcd f3;
> alias m2.efgh f4;
>
> vs:
>
> import m2.func as f2;
> import m2.abcd as f3;
> import m2.efgh as f4;
>
> Not much of a difference. I'm also not understanding why alias is hard  
> to understand.

One very important purpose of programming languages is to help make sense  
to human readers and writers. Redundant repetition is distracting in  
everything except poetry.

Consider this instead ...

  from m2 import f2,f3,f4;

or

  with m2 import f2,f3,f4;

Much easier to write, reead and understand. And probably easier for the  
compiler too.

*Please* do not overload the "static" keyword with yet another definition.  
I have no idea what "static inport" means as a natural phrase. It does not  
imply or suggest anything to me. Is it an import that is down at compile  
time (of course it is 'cos that's when import statements are used), or is  
it something that doesn't change size during the run-time, or is it  
something that retains its place in RAM during the life of the execution?  
Oh no, that's right - in this context it means that you have to FQN  
references. Doh! Bloody obvious isn't it?

-- 
Derek Parnell
Melbourne, Australia



More information about the Digitalmars-d mailing list