Phobos runnable examples - ideas request

nazriel spam at dzfl.pl
Thu Mar 28 09:48:13 PDT 2013


On 03/28/2013 07:18 AM, Jacob Carlborg wrote:
> On 2013-03-27 22:54, nazriel wrote:
>
>> Requesting user to edit code first, add main(){} block or fix invalid D
>> code and then run example itself is unacceptable.
>
> RDMD already has a --main flag and DMD will soon too.
>

Yes, DMD trunk already does that but it doesn't fully address the 
problem. While in cases like
----
unittest {
     assert(...);
     assert(...);
}
----

it will work fine, it will fail in such scenarios:
----
writeln("Hello world");
----

AFAIK -main flag just slaps void main(){} in dummy file.

-- 
Best regards
Damian Ziemba


More information about the Digitalmars-d mailing list