Import concerns revisited
John Reimer
John_member at pathlink.com
Sun Jul 9 12:49:56 PDT 2006
An excellent post. I feel much the same as Sean about the reason it is so
difficult to "convince" in relation to the import syntax issue. It is about
aesthetics to a great extent. But I think the aesthetics are very important in
this situation because it decides how D appears to those trying to understand
the language.
I aslo share Seans feelings concerning the alias attribute. "alias" is a great
addition to the D langauge. Perhaps I was unclear in my last response to
Walter: alias, in itself, is not a hack in the general case. But I believe it
is laborious and ugly when used in the context of modules and imports.
D should be elegant. Using alias and static import comes across as a verbose
workaround when one is working with multiple module imports; in all other cases,
it may be equivalent, but I think it's just plain ugly in comparison to the
alternative syntax using with/as or from/as. It accomplishes something that
could be greatly simplified with an addition of a minor syntax expansion.
-JJR
In article <e8rk68$1fat$1 at digitaldaemon.com>, Sean Kelly says...
>
>Walter Bright wrote:
>> kris wrote:
>>> The use of alias, regarding imports, should very likely be kept to a
>>> bare minimum in anything other than Q&D development. Ideally zero.
>>
>> I really don't understand your pov. I can't help but think you regard
>> alias as like C++'s #define:
>>
>> alias foo bar;
>> #define bar foo
>>
>> Such #define's I would agree are a terrible hack that don't belong in
>> professional code. But aliasing isn't like that, it's a sane and
>> well-behaved replacement.
>
>I think Kris was merely suggesting that the need for a separate alias
>declaration for each import was the problem, not the idea of aliasing
>itself. If a particular module imports 10 others, that's 10 separate
>aliases required as well, and there's no good way to write them in a way
>that makes for easy readability and maintenance. This is the point he
>was trying to make below.
>
<snip great post content>
More information about the Digitalmars-d
mailing list