D seems interesting, but...
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Oct 15 08:22:38 PDT 2012
On 10/15/12 7:24 AM, Paulo Pinto wrote:
> On Monday, 15 October 2012 at 11:20:26 UTC, bearophile wrote:
>> Jacob Carlborg:
>>
>>> How should DMD detect if you're building a (dynamic) library? Sure it
>>> can see that you're not using -lib or -shared but what about separate
>>> complication?
>>
>> What about the need to use a compiler switch if you are performing a
>> separate compilation?
>>
>> A related enhancement request that I'm asking for since years is: the
>> compiler could define a compile-time constant (like is_main_module or
>> something) as true if the module contains the main, and false
>> otherwise. This allows to have a main() in each module. This is handy
>> to have, it allows to compile&run modules both as normal modules to
>> import, or to compile and run them as stand alone programs, like when
>> you want a module to show a demo of its capabilities, or just run its
>> unittests.
>>
>> Bye,
>> bearophile
>
> Yes, this is a nice thing Java, .NET and Python have.
Wonder if a simple convention would suffice, e.g. every module that
wanna defines a moduleMain(string[] args) and then you have one module
main.d that has:
void main(string[] args) { import wuddever; moduleMain(args); }
Andrei
More information about the Digitalmars-d
mailing list