Can't use function with same name as module?
Daniel Kozak
kozzi11 at gmail.com
Tue Oct 17 08:26:12 UTC 2017
You can:
import fun : fun;
int main(string[] args)
{
fun();
return 0;
}
On Tue, Oct 17, 2017 at 10:08 AM, Shriramana Sharma via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:
> On Tuesday, 17 October 2017 at 07:33:15 UTC, evilrat wrote:
>
>> Compiler made that way so it doesn't guess or assume too much, because
>> later on it will bite you when you don't even expect that, and in some
>> unpredictable place too.
>>
>
> Can you give an example for when it will bite me? It seems very natural to
> name a module with the name of the main class or function implemented in
> that module. Python modules like datetime follow this. What is the problem?
>
> Especially in D the compiler is all-powerful and knows when to resolve to
> which symbol. If D compiler can resolve between multiple overloads in other
> cases, why not resolve here?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20171017/6925d9c0/attachment.html>
More information about the Digitalmars-d-learn
mailing list