Website message overhaul, pass 2

bearophile bearophileHUGS at lycos.com
Sun Nov 20 14:45:02 PST 2011


Andrei Alexandrescu:

> Thanks to all who provided feedback! I read again the entire thread, 
> then made one more pass:
> 
> http://d-programming-language.org/new/

On Wikipedia they are asking for some changes:
http://en.wikipedia.org/wiki/D_language


(We don't want to use this on the front page:

import std.stdio, std.string, std.algorithm;

void main() {
    string[][string] signature2words;

    foreach (char[] line; lines(File("words.txt"))) {
        auto cline = line.chomp();
        string word = cline.idup;
        cline.toLowerInPlace();
        (cast(ubyte[])cline).sort();
        signature2words[cline.idup] ~= word;
    }

    foreach (words; signature2words)
        if (words.length > 1)
            writefln(words.join(" "));
}

-------------------------------

I have modified a bit your text, this is not meant to be a final version, but shows a text I like a bit more:

The D programming language

// Finds and prints word anagrams
import std.stdio, std.string, std.algorithm;

void main() {
    dstring[][dstring] signature2words;

    foreach (dstring line; lines(File("words.txt"))) {
        auto word = line.chomp();
        auto key = word.toLower().dup.sort().release().idup;
        signature2words[key] ~= word;
    }

    foreach (words; signature2words)
        if (words.length > 1)
            writefln(words.join(" "));
}

D is a statically typed language with C-like syntax. It tries to combine efficiency and control with safety and programmer productivity.

Convenience

    * The simple type inference of D allow writing code with no redundant type specifications, while keeping static typing safety and efficiency. [Example]
    * The optional garbage collector makes for simple and safe code. D also supports scoped resource management (the RAII idiom) and scope statements for ....... code that is easy to read. [Example]
    * Array slicing syntax, built-in dynamic arrays and associative arrays, and several other features allow to write handy short script-like programs succinctly and safely.

Power

    * D supports classic polymorphism, value semantics, functional style, generics, generative programming and contract programming. [Example]
    * D offers an innovative approach to concurrency featuring true immutable data, message passing, no sharing by default, pure functions and controlled mutable sharing across threads. Read more.
    * D scales to larger projects with unit testing, information hiding, refined modularity, fast compilation and precise interfaces. Read more.

Efficiency

    * D compiles naturally to efficient native code.
    * D is designed such that most obvious code is fast and safe. On occasion you might need to escape the confines of type safety for ultimate speed and control. For such rare cases D offers native pointers, type casts, access to any C function without any intervening translation, and even inline assembly. So D allows to mix high level code and low level code in the same program. [Example]
    * The @safe, @trusted, and @system modular attributes allow the programmer to best decide the safety/efficiency tradeoffs of a particular application, and have the compiler check for consistency. Read more.

Bye,
bearophile


More information about the Digitalmars-d mailing list