Shout out to D at cppcon, when talkign about ranges.

lobo via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 30 17:42:38 PDT 2015


On Wednesday, 30 September 2015 at 22:51:24 UTC, H. S. Teoh wrote:
> On Wed, Sep 30, 2015 at 10:32:16AM -0400, Andrei Alexandrescu
[...]
>
> I watched most of the video (mainly the first half where he 
> goes through the C++ version of the code), and I have to 
> confess I couldn't help noticing just how ugly the C++ syntax 
> is.

This is a key reason I am using D. I really like C++14+boost  but 
that syntax brings me back to D every time.

>
> I mean, overloading operator|() for chaining, seriously?  UFCS 
> is
> superior any day, IMNSHO.

I seem to recall that in a previous on ranges Niebler said that 
operator|() was simply available and had a vague notion of 
chaining thanks to *nix shell. He went on to say it would 
probably need to change to get through the ISO committee.

I hope it does. If the current plans for overloading operator.() 
get up I wonder how well it would fit as a replacement operator.

>
> And overloading operator%() for string interpolation, ugh. 
> (Though this
> one seems to be a Boost thing, not specific to the ranges 
> proposal.)

This is also a Python thing so it's quite prevelant in the wild. 
I find D's ~ much nicer, although minutely slower to type than %


>
> And this is on top of the usual ugliness of C++ template 
> syntax. Not to mention the RANGE_FOREACH macro (I assume it's a 
> macro), where D's foreach has supported natively for years now.
>  (D has seriously ruined my life; I simply can't bring myself 
> to go back to C++ anymore. At least not voluntarily.)
>
> Also, this seems to confirm that C++ is gradually falling to 
> the position where it's playing catch-up with respect to 
> innovations in newer languages like D and Rust. The fact that 
> ranges are being proposed for the C++ standard library is a big 
> endorsement of D, IMO.

C++ has been playing catchup for the last 10 yrs and it's been an 
amazing transition for the language.

If ranges are accepted into ISO C++ I can't imagine it would be 
long before for(auto e:range).

[snip]
>
>> One great action item is to backport some of Eric's ideas to 
>> the D example.  Currently Eric's final code looks nicer than 
>> the D code. -- Andrei
>
> Do you have a list of ideas that should be backported?
>

I really liked the namespaces view:: and action:: because it is 
immediately clear just reading the code what was lazy and what 
was not.

bye,
lobo


More information about the Digitalmars-d mailing list