"Error: function expected before (), not module *module* of type void
Dustin Mays
dustin.biggins.mays at gmail.com
Mon Mar 24 12:14:38 PDT 2008
Steven Schveighoffer Wrote:
> "Dustin Mays" wrote
> > I'm getting the following error message when trying to compile a test-app
> > I wrote:
> > diceroller.d(9): Error: function expected before (), not module rollDice
> > of type void
>
> I know you fixed the problem, but just an FYI, the reason is because when
> you import rollDice, you bring both rollDice the module and rollDice the
> function into the global namespace (which confuses the compiler 'cause it
> doesn't know what symbol you want to use). This is normally avoided in
> libraries by having a package tree. So for example, if you created
> everything in the subdirectory foo, and had your modules be:
>
> module foo.diceroller;
> import foo.rollDice;
>
> Then the import would import the module foo.rollDice, and the function
> rollDice, and the compiler would no longer be confused about what you are
> trying to call.
>
> IMO, this makes it difficult to write multi-file applications that live in
> one directory. It would be nice if this was changed...
>
> -Steve
>
>
Thanks for the explanation, that confirmed what I thought was happening. :)
More information about the Digitalmars-d-learn
mailing list