Irritating shortcoming with modules and externs
Jarrett Billingsley
kb3ctd2 at yahoo.com
Sat May 20 17:59:56 PDT 2006
"Bruno Medeiros" <brunodomedeirosATgmail at SPAM.com> wrote in message
news:e4ngb0$24g4$1 at digitaldaemon.com...
> I do something very similar:
>
> int main(char[][] args)
> {
> // .. proccess args..
> // ..maybe load some libs (like Derelict)..
> App.appmain();
> return 0;
> }
>
> However, in my case, App is a module. If you only have one Context, and it
> is allways active during the program lifetime, why bother creating a
> singleton instead of simply using a module?
At least in my case, the nice thing about having a context class is that I
can derive from it. I can create some other predefined contexts (i.e. which
set some things up for you automatically, or which are designed for a
specific type of program in mind), and by giving them some abstract methods
meant to be overriden, I can create "framework" contexts which are
ready-to-use and which can just be derived and have the extra parts filled
in. That, and a compiler error (an "unimplemented abstract method" error)
is nicer than a linker error saying that it can't find an undefined, mangled
symbol.
More information about the Digitalmars-d-learn
mailing list