foobar:
I'm sorry to say but that *is* a _horrible_ _hack_. It looks
almost as awful as it does in python with the underscores.
Java has the correct DRY solution - each class can define a
static main method but the compiler only uses the one specified
by a compiler switch.
The above basically asks the programmer to endlessly repeat the
same trivial implementation boilerplate that should be written
just once _in_ the compiler.
What I have suggested is the simplest (requires less stuff to be
implemented) way to solve the problem, adding just a single
compile time constant. But I agree there are better ways to solve
the same problem. I am asking for a specific way to solve this
problem, but since some years I'd like some "good enough" way to
solve it.
Bye,
bearophile
- Re: D seems interesting, but... foobar
- Re: D seems interesting, but... Andrei Alexandrescu
- Re: D seems interesting, but... foobar
- Re: D seems interesting, but... bearophile
- Re: D seems interesting, but... Andrei Alexandrescu
- Re: D seems interesting, but... bearophile
- Re: D seems interesting, but... 1100110
- Re: D seems interesting, but... Adam D. Ruppe
- Re: D seems interesting, but... bearophile
- Re: D seems interesting, but... foobar
- Re: D seems interesting, but... bearophile
- Re: D seems interesting, but... bearophile
- Re: D seems interesting, but... Era Scarecrow
- Re: D seems interesting, but... jerro
- Re: D seems interesting, but... Walter Bright
- Re: D seems interesting, but... H. S. Teoh
- Re: D seems interesting, but... Alex Rønne Petersen
- Re: D seems interesting, but... 1100110