www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11277] New: Bad default main.d (bad hello world example)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11277

           Summary: Bad default main.d (bad hello world example)
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: VisualD
        AssignedTo: nobody puremagic.com
        ReportedBy: jakobovrum gmail.com



---
There are a number of small issues with the default-provided main.d file that
have been bugging me for a while:

 * The module with `main` contains an explicit module statement, for which I
can think of no justification

 * The main function uses an `int` return type without actually needing it,
resulting in the boilerplate `return 0;` statement

 * The main function receives the program argument list but doesn't use it.
Even if it did use it, it's named `argv` even though there is no `argc` in D;
`argv` is still potentially a decent name, but I think `args` is more common,
and has no implication of `argc`

I suggest changing it to one of either:
-----
void main()
{
    import std.stdio : writeln;
    writeln("hello, world");
}
-----
Or
-----
import std.stdio;

void main()
{
    writeln("hello, world");
}
-----

The former is probably the most conducive to remaining correct after tweaking.
The latter is probably the most consistently used hello-world example for D2
(e.g. it's used on the front page of wiki.dlang.org).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 15 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11277


Rainer Schuetze <r.sagitario gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario gmx.de



PDT ---
I'll update according to the second suggestion.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 18 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11277




PDT ---
Fixed in v0.3.37rc6 to be found here:

https://github.com/D-Programming-Language/visuald/releases

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 28 2013