Re: [OT] Re: Binding rvalues to const ref in D

2016-10-20 Thread Steven Schveighoffer via Digitalmars-d
On 10/20/16 5:07 PM, Nick Sabalausky wrote: I think I'm going to try to put out first-try pass at a new API in a separate branch, try to get that out as soon as I can, and post it for experimentation/feedback. Awesome! Looking forward to it. -Steve

Re: [OT] Re: Binding rvalues to const ref in D

2016-10-20 Thread Nick Sabalausky via Digitalmars-d
On 10/20/2016 04:32 PM, Steven Schveighoffer wrote: On 10/20/16 12:50 PM, Nick Sabalausky wrote: You can't bind individual values? Is there something wrong with "bindParameter(value, paramIndex)"? (I mean, besides the fact that it takes a ref, and, like the rest of the lib, isn't really

Re: [OT] Re: Binding rvalues to const ref in D

2016-10-20 Thread Steven Schveighoffer via Digitalmars-d
On 10/20/16 12:50 PM, Nick Sabalausky wrote: On 10/20/2016 09:33 AM, Steven Schveighoffer wrote: Yes, it does work. However, one thing that I *sorely* miss is the ability to simply bind an individual value. At the moment, in order to bind a value, you have to pass an array of Variant for all

Re: Binding rvalues to const ref in D

2016-10-20 Thread bitwise via Digitalmars-d
On Wednesday, 19 October 2016 at 15:18:36 UTC, Atila Neves wrote: [...] On the one hand some people want rvalues to bind to const ref. I can only assume that they want this because they want to pass rvalues to a function efficiently [...] struct Vector { float x, y, z; } In games/real-time

Re: [OT] Re: Binding rvalues to const ref in D

2016-10-20 Thread Nick Sabalausky via Digitalmars-d
On 10/20/2016 09:33 AM, Steven Schveighoffer wrote: Yes, it does work. However, one thing that I *sorely* miss is the ability to simply bind an individual value. At the moment, in order to bind a value, you have to pass an array of Variant for all the values. I currently have a whole wrapper

Re: Binding rvalues to const ref in D

2016-10-20 Thread Manu via Digitalmars-d
On 20 October 2016 at 21:07, Ethan Watson via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > On Thursday, 20 October 2016 at 10:36:16 UTC, Manu wrote: > >> DIP25 introduced return ref to address this issue. Just annotate it >> correctly? >> > > I mean, it'll work, but it's not the most

Re: [OT] Re: Binding rvalues to const ref in D

2016-10-20 Thread Steven Schveighoffer via Digitalmars-d
On 10/20/16 2:38 AM, Nick Sabalausky wrote: On 10/19/2016 07:04 PM, Chris Wright wrote: Right. For instance, binding query parameters with mysql-native. The thing you're binding is passed by reference and I'm not sure why. It's been like that since mysql-native's original release, by the

Re: Binding rvalues to const ref in D

2016-10-20 Thread Ethan Watson via Digitalmars-d
On Thursday, 20 October 2016 at 10:36:16 UTC, Manu wrote: DIP25 introduced return ref to address this issue. Just annotate it correctly? I mean, it'll work, but it's not the most secure method to rely on the programmer remembering to do it.

Re: Binding rvalues to const ref in D

2016-10-20 Thread Manu via Digitalmars-d
On 20 October 2016 at 20:16, Ethan Watson via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > On Wednesday, 19 October 2016 at 21:19:03 UTC, Atila Neves wrote: > >> On Wednesday, 19 October 2016 at 15:58:23 UTC, Chris Wright wrote: >> >>> So it seems like the compiler could take care of

Re: Binding rvalues to const ref in D

2016-10-20 Thread Ethan Watson via Digitalmars-d
On Wednesday, 19 October 2016 at 21:19:03 UTC, Atila Neves wrote: On Wednesday, 19 October 2016 at 15:58:23 UTC, Chris Wright wrote: So it seems like the compiler could take care of this by only providing lvalue references but automatically creating those temporary variables for me. It's going

[OT] Re: Binding rvalues to const ref in D

2016-10-20 Thread Nick Sabalausky via Digitalmars-d
On 10/19/2016 07:04 PM, Chris Wright wrote: Right. For instance, binding query parameters with mysql-native. The thing you're binding is passed by reference and I'm not sure why. It's been like that since mysql-native's original release, by the original author, some years ago. I suspect

Re: Binding rvalues to const ref in D

2016-10-20 Thread Ali Çehreli via Digitalmars-d
On 10/19/2016 10:53 PM, Nick Sabalausky wrote: > [C++] just simply wants to *be* > D, takes a couple drunken steps in that direction, and falls flat on its > face. That's too funny! :D Ali

Re: Binding rvalues to const ref in D

2016-10-19 Thread Nick Sabalausky via Digitalmars-d
On 10/19/2016 04:50 PM, Ali Çehreli wrote: My off-topic contribution to this thread: I won't be surprised when C++ will eventually be classified as a case of mass hysteria. That'll happen at the same time modern web technology stacks are classified similarly. Much as I'd love to see that

Re: Binding rvalues to const ref in D

2016-10-19 Thread Chris Wright via Digitalmars-d
On Wed, 19 Oct 2016 21:19:03 +, Atila Neves wrote: > On Wednesday, 19 October 2016 at 15:58:23 UTC, Chris Wright wrote: >> On Wed, 19 Oct 2016 15:18:36 +, Atila Neves wrote: >> >>> The situation is this: if one wants move semantics, one must know when >>> one can move. Because rvalues

Re: Binding rvalues to const ref in D

2016-10-19 Thread Atila Neves via Digitalmars-d
On Wednesday, 19 October 2016 at 15:58:23 UTC, Chris Wright wrote: On Wed, 19 Oct 2016 15:18:36 +, Atila Neves wrote: The situation is this: if one wants move semantics, one must know when one can move. Because rvalues bind to const& in C++, you never know whether the const& is an lvalue

Re: Binding rvalues to const ref in D

2016-10-19 Thread Ali Çehreli via Digitalmars-d
On 10/19/2016 08:18 AM, Atila Neves wrote: > Did you know there's more > than one kind of rvalue in C++? Oh yes: > > http://en.cppreference.com/w/cpp/language/value_category > > Do we want that? NO! My off-topic contribution to this thread: I won't be surprised when C++ will eventually be

Re: Binding rvalues to const ref in D

2016-10-19 Thread Guillaume Piolat via Digitalmars-d
On Wednesday, 19 October 2016 at 15:18:36 UTC, Atila Neves wrote: My question is: do you _really_ need rvalues to bind to const ref for performance? If not, what _do_ you need it for? Is it an instinctive reaction against passing structs by value from C++98 days? imho it's the compiler job

Re: Binding rvalues to const ref in D

2016-10-19 Thread Johan Engelen via Digitalmars-d
On Wednesday, 19 October 2016 at 15:18:36 UTC, Atila Neves wrote: Yes, it's a stupid example. But ldc2 -O3 gives me this for `silly`: Great example, thanks, please more of that :) https://github.com/ldc-developers/ldc/issues/1842 cheers, Johan

Re: Binding rvalues to const ref in D

2016-10-19 Thread Chris Wright via Digitalmars-d
On Wed, 19 Oct 2016 15:18:36 +, Atila Neves wrote: > The situation is this: if one wants move semantics, one must know when > one can move. Because rvalues bind to const& in C++, you never know > whether the const& is an lvalue or rvalue. To clarify: You copy lvalues instead of moving them.