[OT] ISO C++ 17 changes

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 4 09:49:55 PDT 2017


On Tue, Apr 04, 2017 at 01:38:32AM -0700, Walter Bright via Digitalmars-d wrote:
> On 4/3/2017 11:24 AM, Meta wrote:
> > I don't know how fold expressions could be emulated in D.
> 
> http://dlang.org/phobos/std_algorithm_iteration.html#.fold

That is not what "fold expressions" mean.  Fold expressions are
newly-introduced C++ syntax where you can write:

	bool b = ... && args;

(with a literal "...") and the compiler automatically expands it to
`args[0] && args[1] && args[2]` (assuming args has 3 elements).

Of course, whether or not D ought to have such a thing is up for debate.
My present opinion is that D doesn't need it, because D's compile-time
capabilities are already convenient enough to use without needing
special syntax support from the language.


T

-- 
Customer support: the art of getting your clients to pay for your own incompetence.


More information about the Digitalmars-d mailing list