Entry (main) method inside a class?

Thomas Kuehne thomas-dloop at kuehne.cn
Sat Mar 17 04:24:44 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frits van Bommel schrieb am 2007-03-16:
> Dejan Lekic wrote:
>> Is there particular reason why we are not able to have entry (main) method inside a class, like is possible in JAVA for an example?
>> Even though I am not a big JAVA fan, I must say I like that feature... :)
>
> AFAIK the only reason Java has that "feature" is its complete inability 
> to have functions *outside* of classes :).
>
> Though I could see uses for this, like to run unittests (similarly to 
> what running Python modules "stand-alone" often does).
> D has gone another way there though, using explicit unittest {} blocks. 
> Unfortunately, there is currently no way to run these separately (esp. 
> right after compilation) that I know of.

Flectioned's unittest walker does exactly that:

dmd -unittest -g -c <your source>
dmd flectioned.d unittest_walker.d -ofwhatever <your objects>
./whatever

http://flectioned.kuehne.cn

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFF+9PRLK5blCcjpWoRAoiGAJ91UUkumd3LfoFb771S1Z/Y42ADowCfaqqT
JN5WpxZdThF7LTl906mSs04=
=R0ZY
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list