Marketing of D - article topic ideas?

Nick Sabalausky a at a.a
Sun Jun 6 21:58:26 PDT 2010


"dsimcha" <dsimcha at yahoo.com> wrote in message 
news:huh892$agk$1 at digitalmars.com...
>
> /**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;
> }
>

I clearly haven't been following D2 closely enough. Or maybe I'm just more 
tired than I think... Can you explain that function signature?:
CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) {

> 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.)
>

C++0x^H^H1x is starting to remind me of Duke Nukem Forever. (Except I 
actually gave a rat's ass about Duke ;) )

> 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?
>

I bet there's a lot of people who wouldn't bat an eye at that idea. 
Unfortunately.

> 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).
>

I actually find that funny. Something in Java that isn't an Object? I 
remember "Everything's an object!" being paraded around as a selling point.




More information about the Digitalmars-d mailing list