On Wednesday, 23 January 2019 at 17:28:37 UTC, H. S. Teoh wrote:
The best way to do this is to use a string DSL or a delegate as
template argument. For example:
auto result = User.filter!q{ User.name == "John" };
or:
auto result = User.filter!(u => u.name == "John");
I didn
On Thursday, 24 January 2019 at 00:47:37 UTC, Ali Çehreli wrote:
Yeah, that can't work. Remove the bool-returning one and your
code works with the 'alias this' above.
Wow, this is an amazing workaround! I didn't think about it in
that way.
It perfectly solves the issue.
Thank you!
On Wed, 23 Jan 2019 15:19:06 +, Jacob Shtokolov wrote:
> I'm wondering, is that possible to declare multiple versions of
> opEquals() and evaluate them in the different places depending on return
> type?
I looked at this a while ago for similar reasons. It didn't pan out.
When you override th
On 01/23/2019 07:19 AM, Jacob Shtokolov wrote:
> Expressions like `User.id == 10`, `User.age > 18`, etc. should return a
> struct instead of a bool (let's call it `struct BinaryExpression`).
Have you considered 'alias this'?
struct BinaryExpr(T)
{
T left;
T right;
Op op;
bool value() c
On Wed, Jan 23, 2019 at 03:19:06PM +, Jacob Shtokolov via
Digitalmars-d-learn wrote:
> Hi,
>
> I'm trying to check whether it's possible to implement Python's
> SQLAlchemy-like query syntax in D, but I get stuck a bit.
>
> Here is a simple example of what I want to achieve:
>
> ```
> auto r
On Wednesday, 23 January 2019 at 15:28:02 UTC, Jonathan M Davis
wrote:
But regardless of the specifics of operator overloading in D, D
does not support overloading _any_ functions on the return type.
Thanks!
On Wednesday, January 23, 2019 8:19:06 AM MST Jacob Shtokolov via
Digitalmars-d-learn wrote:
> Hi,
>
> I'm trying to check whether it's possible to implement Python's
> SQLAlchemy-like query syntax in D, but I get stuck a bit.
>
> Here is a simple example of what I want to achieve:
>
> ```
> auto
Hi,
I'm trying to check whether it's possible to implement Python's
SQLAlchemy-like query syntax in D, but I get stuck a bit.
Here is a simple example of what I want to achieve:
```
auto result = User.filter(User.id == 10);
result = User.filter(User.name == "John");
result = User.filter(User.