Import proposals (Ideas)
jcc7
jcc7_member at pathlink.com
Wed Jul 12 10:03:49 PDT 2006
In article <e938po$1cn1$1 at digitaldaemon.com>, BCS says...
>
>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.
I'm just not a big fan of using with for this since it seems like importing to
me.
"with(module fooTooLong)" would be somewhat better, but I think "import" should
be there. How about this?
# import select fooTooLong
# {
# alias reallyTooLong tooShort; /* alias */
# alias reallyTooLong2 tooShort2; /* alias 2 */
# alias notReallyTooLongAtAll notReallyTooLongAtAll; /* No alias */
# }
or if you just want to import one it'd be something like this:
import select std.string.replace alias replace;
or maybe even this if it's not being renamed...
import select std.string.replace;
I think there's a really good syntax in here somewhere. I'm just not sure what
it is yet...
jcc7
More information about the Digitalmars-d
mailing list