How about Go's... error on unused imports?
KennyTM~
kennytm at gmail.com
Sun Nov 15 07:25:58 PST 2009
On Nov 15, 09 04:38, Leandro Lucarella wrote:
> KennyTM~, el 15 de noviembre a las 03:17 me escribiste:
>>> once upon a time there was a suggestion to have a special file that
>>> would define the public API of a package.
>>>
>>> e.g.
>>>
>>> myPackage
>>> a.d
>>> b.d
>>> ...
>>> this.d // special file that defines the public imports
>>> private.d // should not be imported by a "*" import
>>>
>>> then, the user can import myPackage.* and that would search for this.d
>>> in the directory and use its contents instead of importing all d files
>>> in the directory.
>>
>> How is it different from using an all.d and import myPackage.all ?
>
> It will just make importing shorter (and it will encourage people to use
> the "all" trick as it's part of the language and not just a convention).
>
I think the problem isn't it's shorter (use could use myPackage/a.d),
but not enough important libraries are using this trick. For C/Obj-C on
Mac OS X programming, to import a whole framework you always use #import
<frameworkName/frameworkName.h>. This is just a convention, but everyone
is using this, because it's a standardized convention. Imagine if there
are std.all & tango.all.
More information about the Digitalmars-d
mailing list