Re: [OT] ISO C++ 17 changes

2017-04-08 Thread Martin Nowak via Digitalmars-d
On Tuesday, 4 April 2017 at 13:45:47 UTC, Meta wrote: I mean what goes on inside fold. If you look at the C++ example it's very concise and IMO beautiful: auto f(Args ...args) { return (0 + ... + args); } It's special syntax for a very limited (only infix operators) and rather obscure

Re: [OT] ISO C++ 17 changes

2017-04-06 Thread Jack Stouffer via Digitalmars-d
On Tuesday, 4 April 2017 at 15:41:08 UTC, Russel Winder wrote: Interestingly, or not, Python 3.6 introduces string interpolation even though Python already has the format function. And pythonistas are happy about this. I can say the redditor Python userbase wasn't. The same sentiment was

Re: [OT] ISO C++ 17 changes

2017-04-06 Thread Timon Gehr via Digitalmars-d
On 03.04.2017 23:43, Meta wrote: On Monday, 3 April 2017 at 21:33:20 UTC, Timon Gehr wrote: On 03.04.2017 20:24, Meta wrote: On Monday, 3 April 2017 at 08:53:57 UTC, Andrea Fontana wrote: https://isocpp.org/files/papers/p0636r0.html The fold expressions and inference of constructor template

Re: [OT] ISO C++ 17 changes

2017-04-05 Thread Nick Treleaven via Digitalmars-d
On Tuesday, 4 April 2017 at 13:30:47 UTC, Meta wrote: On Tuesday, 4 April 2017 at 08:38:32 UTC, Walter Bright wrote: http://dlang.org/phobos/std_algorithm_iteration.html#.fold Not quite the same as this is a fold over a TypeTuple/AliasSeq. You could of course do: only(args).fold!"a + b"()

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread H. S. Teoh via Digitalmars-d
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

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread Russel Winder via Digitalmars-d
On Tue, 2017-04-04 at 12:46 +, Xinok via Digitalmars-d wrote: > On Tuesday, 4 April 2017 at 02:43:26 UTC, evilrat wrote: > > String interpolation would be nice too, it would really help  > > with readability! > > This really isn't in the spirit of D and is better left to  > library functions

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread ag0aep6g via Digitalmars-d
On 04/04/2017 03:45 PM, Meta wrote: I mean what goes on inside fold. Ok. That's what I missed. If you look at the C++ example it's very concise and IMO beautiful: auto f(Args ...args) { return (0 + ... + args); } But the shown `fold` implements the functionality of that C++ language

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread Dukc via Digitalmars-d
On Tuesday, 4 April 2017 at 13:45:47 UTC, Meta wrote: I mean what goes on inside fold. If you look at the C++ example it's very concise and IMO beautiful: Luckily that hardly matters, you just need to define one generic template for the whole program, which can even be in a library. Btw my

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread Meta via Digitalmars-d
On Tuesday, 4 April 2017 at 13:38:57 UTC, ag0aep6g wrote: On 04/04/2017 03:29 PM, Meta wrote: On Tuesday, 4 April 2017 at 05:04:04 UTC, Dukc wrote: [...] fold!"+"(1, 2, 3).writeln; //6 [...] However, it's still more verbose. My goal was to emulate almost exactly what C++ was doing by

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread ag0aep6g via Digitalmars-d
On 04/04/2017 03:29 PM, Meta wrote: On Tuesday, 4 April 2017 at 05:04:04 UTC, Dukc wrote: [...] fold!"+"(1, 2, 3).writeln; //6 [...] However, it's still more verbose. My goal was to emulate almost exactly what C++ was doing by using a template so you could just write "fold!('+', args)"

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread Meta via Digitalmars-d
On Tuesday, 4 April 2017 at 08:38:32 UTC, Walter Bright 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 Not quite the same as this is a fold over a TypeTuple/AliasSeq. You could of

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread Meta via Digitalmars-d
On Tuesday, 4 April 2017 at 05:04:04 UTC, Dukc wrote: On Monday, 3 April 2017 at 21:43:41 UTC, Meta wrote: On Monday, 3 April 2017 at 21:33:20 UTC, Timon Gehr wrote: Any suggestions as to how to get something similar working? auto fold(string op, Args...)(Args args) { foreach(e; args[1 ..

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread Xinok via Digitalmars-d
On Tuesday, 4 April 2017 at 02:43:26 UTC, evilrat wrote: String interpolation would be nice too, it would really help with readability! This really isn't in the spirit of D and is better left to library functions which give the user far more power and flexibility. Incorporating such a

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread evilrat via Digitalmars-d
On Tuesday, 4 April 2017 at 10:40:19 UTC, Guillaume Piolat wrote: On Tuesday, 4 April 2017 at 08:16:48 UTC, evilrat wrote: Well, thanks, I guess... But it seems no one else interested in such feature. I get it. Sure this shouldn't be top priority thing and it can(it surely will) be hard to

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread Guillaume Piolat via Digitalmars-d
On Tuesday, 4 April 2017 at 08:16:48 UTC, evilrat wrote: Well, thanks, I guess... But it seems no one else interested in such feature. I get it. Sure this shouldn't be top priority thing and it can(it surely will) be hard to implement in compiler, and this maybe not an option for such a

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread Walter Bright via Digitalmars-d
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

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread evilrat via Digitalmars-d
On Tuesday, 4 April 2017 at 07:21:09 UTC, Andrea Fontana wrote: On Tuesday, 4 April 2017 at 06:13:24 UTC, evilrat wrote: On Tuesday, 4 April 2017 at 05:53:00 UTC, Patrick Schluter wrote: On Tuesday, 4 April 2017 at 05:36:55 UTC, evilrat wrote: On Tuesday, 4 April 2017 at 05:18:26 UTC, Dukc

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread Andrea Fontana via Digitalmars-d
On Tuesday, 4 April 2017 at 06:13:24 UTC, evilrat wrote: On Tuesday, 4 April 2017 at 05:53:00 UTC, Patrick Schluter wrote: On Tuesday, 4 April 2017 at 05:36:55 UTC, evilrat wrote: On Tuesday, 4 April 2017 at 05:18:26 UTC, Dukc wrote: On Tuesday, 4 April 2017 at 02:43:26 UTC, evilrat wrote:

Re: [OT] ISO C++ 17 changes

2017-04-04 Thread evilrat via Digitalmars-d
On Tuesday, 4 April 2017 at 05:53:00 UTC, Patrick Schluter wrote: On Tuesday, 4 April 2017 at 05:36:55 UTC, evilrat wrote: On Tuesday, 4 April 2017 at 05:18:26 UTC, Dukc wrote: On Tuesday, 4 April 2017 at 02:43:26 UTC, evilrat wrote: [...] writeln("Your item: ", someName, " = ",

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread Patrick Schluter via Digitalmars-d
On Tuesday, 4 April 2017 at 05:36:55 UTC, evilrat wrote: On Tuesday, 4 April 2017 at 05:18:26 UTC, Dukc wrote: On Tuesday, 4 April 2017 at 02:43:26 UTC, evilrat wrote: [...] But if all you want is to construct some code in interpreter-like way at compile time, string mixin does precisely

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread evilrat via Digitalmars-d
On Tuesday, 4 April 2017 at 05:18:26 UTC, Dukc wrote: On Tuesday, 4 April 2017 at 02:43:26 UTC, evilrat wrote: String interpolation would be nice too, it would really help with readability! But if all you want is to construct some code in interpreter-like way at compile time, string mixin

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread Dukc via Digitalmars-d
On Tuesday, 4 April 2017 at 02:43:26 UTC, evilrat wrote: String interpolation would be nice too, it would really help with readability! If you mean runtime interpolation, that means one has to bundle the interpreter with the executable, and sacrifice alot of code speed. I recall that there

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread Dukc via Digitalmars-d
^ sorry misquote

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread Dukc via Digitalmars-d
On Monday, 3 April 2017 at 21:43:41 UTC, Meta wrote: On Monday, 3 April 2017 at 21:33:20 UTC, Timon Gehr wrote: Any suggestions as to how to get something similar working? auto fold(string op, Args...)(Args args) { foreach(e; args[1 .. $]) args[0] += e; return args[0]; } void main() {

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread evilrat via Digitalmars-d
On Tuesday, 4 April 2017 at 00:46:25 UTC, mogu wrote: On Monday, 3 April 2017 at 18:24:31 UTC, Meta wrote: On Monday, 3 April 2017 at 08:53:57 UTC, Andrea Fontana wrote: https://isocpp.org/files/papers/p0636r0.html The fold expressions and inference of constructor template args look very

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread mogu via Digitalmars-d
On Monday, 3 April 2017 at 18:24:31 UTC, Meta wrote: On Monday, 3 April 2017 at 08:53:57 UTC, Andrea Fontana wrote: https://isocpp.org/files/papers/p0636r0.html The fold expressions and inference of constructor template args look very nice. C++ is quickly catching up to D in a lot of areas,

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread Meta via Digitalmars-d
On Monday, 3 April 2017 at 21:33:20 UTC, Timon Gehr wrote: On 03.04.2017 20:24, Meta wrote: On Monday, 3 April 2017 at 08:53:57 UTC, Andrea Fontana wrote: https://isocpp.org/files/papers/p0636r0.html The fold expressions and inference of constructor template args look very nice. C++ is

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread Timon Gehr via Digitalmars-d
On 03.04.2017 20:24, Meta wrote: On Monday, 3 April 2017 at 08:53:57 UTC, Andrea Fontana wrote: https://isocpp.org/files/papers/p0636r0.html The fold expressions and inference of constructor template args look very nice. C++ is quickly catching up to D in a lot of areas, although usually

Re: [OT] ISO C++ 17 changes

2017-04-03 Thread Meta via Digitalmars-d
On Monday, 3 April 2017 at 08:53:57 UTC, Andrea Fontana wrote: https://isocpp.org/files/papers/p0636r0.html The fold expressions and inference of constructor template args look very nice. C++ is quickly catching up to D in a lot of areas, although usually still with worse syntax. I don't

[OT] ISO C++ 17 changes

2017-04-03 Thread Andrea Fontana via Digitalmars-d
https://isocpp.org/files/papers/p0636r0.html