[Gambas-user] can't call a procedure from a different module
Benoît Minisini
gambas at ...1...
Wed Dec 2 19:04:45 CET 2009
> [SOLVED]
>
> Kadaitcha Man wrote:
> > 2009/12/2 kevinfishburne <kevinfishburne at ...1887...>:
> >> (2) Module "Server" then calls the procedure "Init" contained within
> >> module
> >> "Net" (Net.Init).
> >
> > Net is reserved for the Net class of constants in gambas. Rename the
> > module.
> >
> > -------------------------------------------------------------------------
> >----- Join us December 9, 2009 for the anonymous postings of fortune
> > stdout!!! _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
> Thanks. Renaming the network module from "Net" to "Network" worked. I'm
> glad is was a simple mistake. Thanks again.
>
It's not totally a mistake of yours, but a decision made by the compiler the
first time the "Net" identifier is encountered:
"Should I use the global Net class from the gb.net component or the Net class
defined in the project?"
The common programmer logic would tell to decide the second solution. But then
we are hiding a class of an official component, which is not a good idea. It
makes the program less readable, a bit like when you override operators in
C++: a well-known language "thing" actually does not do what it should at
first sight.
So I chose the first solution, which usually prints an error when you try to
access your class.
If you really want mixing your own Net class with the official one, you can
export it. This way, your own class will inherit and override the Net official
class, so that you can add the feature you need to it.
Regards,
--
Benoît Minisini
More information about the User
mailing list