Proposal: Package aliases

Ary Borenszweig ary at esperanto.org.ar
Fri May 16 07:59:15 PDT 2008


Leandro Lucarella wrote:
> Ary Borenszweig, el 15 de mayo a las 18:58 me escribiste:
>> Leandro Lucarella escribió:
>>> Ary Borenszweig, el 15 de mayo a las 11:07 me escribiste:
>>>> Bill Baxter wrote:
>>>>> I think it would be convenient if packages could be aliased.
>>>> I'm really amazed that this is a problem. For example in Java, I almost never need to 
>>>> worry about the name of a package or if the package name is long, or how many characters 
>>>> I'll have to write in the import. Why? Simply because I use an IDE that does that for 
>>>> me. 
>>> IDEs help to to write code, not read it. Code is readed much more times
>>> than it's written, so having a clean reable code is a good thing =)
>> Exactly. If you read "Float.toString(5);" you first say "Ok, toString must be some static 
>> method of some class or struct Float". Then you start searching and realize it's an alias, 
>> or an aliased imported symbol. So to actually understand the code you need to make some 
>> jumps through the source code... indirections. I prefer to write the fqn if there are 
>> ambiguities.
> 
> This is not a problem when there is locality. If modules, classes and
> functions are small (they should be :), you don't have to remember a lot
> of stuff. I find myself doing a lot of aliases and I never find myself in
> the situation where I don't know where things come from.

Not you... but other readers of your code? :-)



More information about the Digitalmars-d mailing list