Import proposals (Ideas)

BCS BCS at pathlink.com
Wed Jul 12 09:46:39 PDT 2006


Anders Runesson wrote:
> mån 2006-07-10 klockan 18:26 +0000 skrev jcc7:
> 
>>In article <e8u2s1$1li1$1 at digitaldaemon.com>, Chris Nicholson-Sauls says...
>>
>>>jcc7 wrote:
>>>
>>>>In article <optcf2eoqc23k2f5 at nrage>, Regan Heath says...
>>>>
>>>>
>>>>>Sub-thread for ideas.
>>>>
>>>>
>>>>I'm not thrilled about the prospect of reusing static for yet another purpose,
>>>>but I don't think that we need to add "from" or "as" to the keyword list either.
>>>>
>>>>Instead of 
>>>>"import fooTooLong.reallyTooLong as fooShort;"
>>>>
>>>>we could re-use an operator:
>>>>"import fooTooLong.reallyTooLong = fooShort;"
>>>>
>>>>I like it, but it could just be me.
>>>
>>>I think its a pretty neat idea, actually.  Although, maybe it should be the colon instead?
>>
>>I thought about colon, but people will probably want to do things like this and
>>I think the colon meaning could get confusing:
>>
>>With equal symbol...
>>
>>public:
>>import fooTooLong.reallyTooLong = fooShort;
>>import fooTooLong.reallyTooLong2 = fooShort2;
>>
>>
>>With colon symbol...
>>
>>public:
>>import fooTooLong.reallyTooLong : fooShort;
>>import fooTooLong.reallyTooLong2 : fooShort2;
> 
> 
> perhaps something like this: 
> 
> import fooTooLong {
> 	reallyTooLong: tooShort,    /* alias */
> 	reallyTooLong2: tooShort2,  /* alias 2
> 	notReallyTooLongAtAll       /* No alias */
> }
> 
> to make several aliases from the same module? My 2c.
> 
> /Anders
> 

I was thinking about that kind of thing my self. Seems logical. Some 
variations might be considered.

drop the import all together, (we aren't really importing "fooTooLong" 
after all, just some stuff in it):

with(fooTooLong)
{
    alias reallyTooLong tooShort;    /* alias */
    alias reallyTooLong2 tooShort2;  /* alias 2 */
    alias notReallyTooLongAtAll notReallyTooLongAtAll; /* No alias */
}

(only "with" at global scope so should parse)

Some hybrid of the two might look nice also.



More information about the Digitalmars-d mailing list