Today the Hobbyist, Tommorow, The World!

Dave Dave_member at pathlink.com
Wed May 3 13:00:49 PDT 2006


charles wrote:
> Very cool.  This is the type of design I like, extremely easy to use -- big
> easy icons -- absouletly no thought required to navigate :).
> 
> Charlie
>
> "David Gileadi" <foo at bar.com> wrote in message
> news:e3ajnh$31ir$1 at digitaldaemon.com...
>> nick wrote:
>>  >> What we need is a dprogramming.com marketing site, with examples,
>>  >> tutorials, a beginniner package, and flashy stuff.
>>  >
>>  > I will donate an existing layout or make a new one.
>>
>> Here's a mockup I've started, having been thinking much along the same
>> lines as Kyle.  It's loosely based on www.mono-project.com  Hopefully it
>> can help the discussion.
>>
>> http://img114.imageshack.us/my.php?image=mockup5ey.jpg (forgive the
>> imageshack hosting)
>>
>> Obviously the front page needs a lot more content.  I was thinking that
>> the "What is D?" section should have links to the following:
>>
>>    - Comparison
>>    - Examples
>>    - FAQ
>>    - Docs
>>    - License
>>
>> I also think there should be a small section before or after giving a
>> quick explanation of what D is, why I should use it, maybe what
>> platforms it works on, etc.
>>
>> The "What's New" section might contain the latest releases from the
>> changelog as well as any community announcements (maybe culled from
>> d.announce).  Of course this would require someone to maintain the list :)
>>
>> Finally I beg Walter's forgiveness for modifying the DigitalMars logo.
>> I just think it looks better this way :)
>>
>> -Dave
> 
> 

Agreed - that is great! I like all the ideas posted here recently, but 
this one is so clutter-free it just invites one to explore further.

An idea for whatever the style outcome - post a link to something like 
this somewhere, or otherwise a "Sample Code" page. The idea would be to 
provide people in a hurry (a) nice short example(s) showing some of the 
primary D features. For example, I would think this would be something 
C++ coders could quickly scan and be intrigued by:

#!/usr/bin/dmd -run
/* sh style script syntax is supported! */

/* Hello World in D
    To compile:
    dmd hello.d
     or to optimize:
    dmd -O -inline -release hello.d
*/

import std.stdio;

void main(char[][] args)
{
     writefln("Hello World, Reloaded");

     // auto type inference and built-in foreach
     foreach(argc, argv; args)
     {
         // OOP!
         CmdLin cl = new CmdLin(argc, argv);
         // improved printf!!
         writefln(cl.argnum, cl.suffix, " arg: %s", cl.argv);
         // Garbage Collection or explicit memory management!!!
         delete cl;
     }

     // Nested structs, classes and functions!
     struct specs
     {
	    // all vars. automatically initialized
         int count, allocated;
     }

     specs argspecs(char[][] args)
     {
         specs* s = new specs;
         // no need for '->'
         s.count = args.length;
         s.allocated = typeof(args).sizeof; // built-in properties for 
native types
         foreach(argv; args)
             s.allocated += argv.length * typeof(argv[0]).sizeof;
         return *s;
     }

     // built-in string and common string operations
     writefln("argc = %d, " ~ "allocated = 
%d",argspecs(args).count,argspecs(args).allocated);
}

class CmdLin
{
     private int _argc;
     private char[] _argv;

public:
     this(int argc, char[] argv)
     {
         _argc = argc;
         _argv = argv;
     }

     int argnum()
     {
         return _argc + 1;
     }

     char[] argv()
     {
         return _argv;
     }

     char[] suffix()
     {
         char[] suffix = "th";
         switch(_argc)
         {
         case 0:
             suffix = "st";
             break;
         case 1:
             suffix = "nd";
             break;
         case 2:
             suffix = "rd";
             break;
         default:
         }
         return suffix;
     }
}



More information about the Digitalmars-d mailing list