Marketing of D - article topic ideas?
dsimcha
dsimcha at yahoo.com
Sun Jun 6 15:42:42 PDT 2010
== Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> D is an extremely powerful language, but when I read complaints and sighs about
> other languages, few seem to know that these problems are solved with D.
> Essentially, we have a marketing problem.
> One great way to address it is by writing articles about various aspects of D
> and how they solve problems, like
>
http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/
> which was well received on reddit.
> Anyone have good ideas on topics for D articles? And anyone want to stand up and
> write an article?
> They don't have to be comprehensive articles (though of course those are
> better), even blog entries will do.
This probably won't be replied to because I'm starting a new sub-thread in a
mature discussion, but I wonder if we could write about the advantages and
disadvantages of duck typing vs. static typing, comparing Python vs. Java at
first, then bring D into the picture to show how, to a greater extent than C++
templates or C#/Java generics, it solves may of the problems of static typing
without introducing the pitfalls of duck typing.
Here's a simple example of something that would be awkward to impossible to do
efficiently in any other language:
/**Finds the largest element present in any of the ranges passed in.\
*/
CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) {
// Quick and dirty impl ignoring error checking:
typeof(return) ret = args[0].front();
foreach(arg; args) {
foreach(elem; arg) {
ret = max(elem, ret);
}
}
return ret;
}
Do this in C++ -> FAIL because there are no variadics. (Yes, C++1x will have
them, but I might die of old age by the time C++1x exists.)
Do this in any dynamic language -> FAIL because looping is so slow that you might
die of old age before it executes. Besides, who wants to do computationally
intensive, multithreaded work in a dynamic language?
Do this in Java -> FAIL because arrays are primitives, not Objects and variadics
only work with Objects. You can't easily make an array of arrays because the
elements of args may be different but related types (e.g. int, float).
Do this in C# -> FAIL because variadics aren't type-safe. You just get an array
of Object, which you have to cast, and w/o some extra information you don't know
what to cast them to.
More information about the Digitalmars-d
mailing list