On 09/15/2015 06:53 PM, Andrei Alexandrescu wrote:
On 09/14/2015 03:35 PM, Timon Gehr wrote:
On 09/14/2015 08:09 PM, Andrei Alexandrescu wrote:
On 09/13/2015 10:06 AM, Martin Nowak wrote:
...
- language regularization
It's surprising to find these "arbitrary" language limitations.
The
On 09/14/2015 03:35 PM, Timon Gehr wrote:
On 09/14/2015 08:09 PM, Andrei Alexandrescu wrote:
On 09/13/2015 10:06 AM, Martin Nowak wrote:
...
- language regularization
It's surprising to find these "arbitrary" language limitations.
The non-predictability of what's possible has always
On Sunday, 13 September 2015 at 17:16:40 UTC, Daniel N wrote:
int opCmp(Foo rhs)
{
return (id > rhs.id) - (id < rhs.id);
}
IMO, subtracting boolean values is bad code style, it's better to
be explicit about your intention:
(id > rhs.id ? 1 : 0) - (id < rhs.id ? 1 : 0)
On Friday, 11 September 2015 at 19:41:41 UTC, Martin Nowak wrote:
Does anyone have a different idea how to make a nice query
language? db.get!Person.where!(p => p.age > 21 && p.name ==
"Peter")
In our last project we took the following approach:
`auto q =
On Friday, 11 September 2015 at 19:41:41 UTC, Martin Nowak wrote:
AFAIK expression templates are the primary choice tom implement
SIMD and
matrix libraries.
And I still have [this
idea](http://dpaste.dzfl.pl/cd375ac594cf) of
implementing a nice query language for ORMs.
While expression
On 09/14/2015 03:47 PM, Sebastiaan Koppe wrote:
>
> In our last project we took the following approach:
>
> `auto q = query.builder!Person.age!">"(20).name("Peter");`
Interesting idea.
On Monday, 14 September 2015 at 18:17:05 UTC, Adam D. Ruppe wrote:
On Monday, 14 September 2015 at 13:47:10 UTC, Sebastiaan Koppe
wrote:
`auto q = query.builder!Person.age!">"(20).name("Peter");`
I confess that I'm not really paying attention to this thread,
but I can't help but think plain
On 09/13/2015 10:06 AM, Martin Nowak wrote:
On 09/13/2015 05:03 AM, Andrei Alexandrescu wrote:
Yah, understood. Problem here is the approach is bound to run into walls
at every few steps. Say you fix the comparisons to work. Then you have
operators such as LIKE that are necessary yet not
On 09/13/2015 01:16 PM, Daniel N wrote:
On Sunday, 13 September 2015 at 14:06:46 UTC, Martin Nowak wrote:
struct Foo
{
size_t id;
int opCmp(Foo rhs)
{
if (id < rhs.id) return -1;
if (id == rhs.id) return 0;
else return 1;
}
bool
On Monday, 14 September 2015 at 13:47:10 UTC, Sebastiaan Koppe
wrote:
`auto q = query.builder!Person.age!">"(20).name("Peter");`
I confess that I'm not really paying attention to this thread,
but I can't help but think plain old literal: `Person.age > 20 &&
Person.name = 'Peter'` is nicer.
On 09/13/2015 03:06 PM, Martin Nowak wrote:
On 09/13/2015 07:16 PM, Daniel N wrote:
Could you try this?
int opCmp(Foo rhs)
{
return (id > rhs.id) - (id < rhs.id);
}
That's not the point, opCmp requires twice as many comparisons as needed
for <. If they are more expansive, e.g. string
On 09/14/2015 07:32 AM, burjui wrote:
On Sunday, 13 September 2015 at 17:16:40 UTC, Daniel N wrote:
int opCmp(Foo rhs)
{
return (id > rhs.id) - (id < rhs.id);
}
IMO, subtracting boolean values is bad code style
I love it! -- Andrei
On 09/14/2015 08:09 PM, Andrei Alexandrescu wrote:
On 09/13/2015 10:06 AM, Martin Nowak wrote:
...
- language regularization
It's surprising to find these "arbitrary" language limitations.
The non-predictability of what's possible has always been a huge issue
for me with C++, i.e. you
On Monday, 14 September 2015 at 19:35:39 UTC, Timon Gehr wrote:
Furthermore, having arbitrary designed-in irregularities is not
comparable to implementing a system whose emergent behavior is
not understood sufficiently well. (D is guilty of both, but the
former is much easier to fix than the
On 09/14/2015 08:18 PM, Andrei Alexandrescu wrote:
On 09/13/2015 01:16 PM, Daniel N wrote:
On Sunday, 13 September 2015 at 14:06:46 UTC, Martin Nowak wrote:
struct Foo
{
size_t id;
int opCmp(Foo rhs)
{
if (id < rhs.id) return -1;
if (id == rhs.id)
On Monday, 14 September 2015 at 18:24:00 UTC, Andrei Alexandrescu
wrote:
On 09/14/2015 07:32 AM, burjui wrote:
On Sunday, 13 September 2015 at 17:16:40 UTC, Daniel N wrote:
int opCmp(Foo rhs)
{
return (id > rhs.id) - (id < rhs.id);
}
IMO, subtracting boolean values is bad code style
I
Am 11.09.2015 um 21:40 schrieb Martin Nowak:
I find the reasons for turining down my ER a bit moot.
[Issue 14593 – operator overloading can't be used with expression
templates](https://issues.dlang.org/show_bug.cgi?id=14593)
(...)
The missing support for overloading the individual relational
On Sunday, 13 September 2015 at 03:03:44 UTC, Andrei Alexandrescu
wrote:
Yah, understood. Problem here is the approach is bound to run
into walls at every few steps. Say you fix the comparisons to
work. Then you have operators such as LIKE that are necessary
like(Person.Name,"peter%")
On Sunday, 13 September 2015 at 03:03:44 UTC, Andrei Alexandrescu
wrote:
On 09/12/2015 04:08 PM, Martin Nowak wrote:
On Friday, 11 September 2015 at 23:47:42 UTC, Andrei
Alexandrescu wrote:
1. Use lambdas, which seem to already do what you want:
db.get!Person.filter!(p => p.age > 21 && p.name
I am pretty sure I'd prefer hygienic string DSL (with explicit
alias list for used context symbols, like in Diet) over LINQ-like
magic.
On Saturday, 12 September 2015 at 22:38:53 UTC, Bahman Movaqar
wrote:
Django's approach is, IMO, the cleverest and least magical one
while keeping it expressive and efficient:
Person.objects.filter(age__gt=21, name__eq='peter')
As the main examples in this thread are for ORMs, I think
On 09/13/2015 03:15 PM, Jack Stouffer wrote:
>
> I know that this effect is much harder to create in a explicitly and
> strongly typed language, but I just wanted to show a real world example
> of how these could be used to great effect.
But it is doable in D, and even better it's possible to
On Sunday, 13 September 2015 at 14:06:46 UTC, Martin Nowak wrote:
- logical indexing x[x < 20]
e.g. opBinary!"<" returns a bit mask to select entries of a
large vector
Oh yes please! This is one of the more powerful features of numpy.
On 09/13/2015 05:03 AM, Andrei Alexandrescu wrote:
> Yah, understood. Problem here is the approach is bound to run into walls
> at every few steps. Say you fix the comparisons to work. Then you have
> operators such as LIKE that are necessary yet not representable in D. So
> more tricks are in
On 09/13/2015 11:00 AM, Sönke Ludwig wrote:
> I had played around with some ideas for a similar project, but didn't
> find a really satisfying solution:
> https://github.com/rejectedsoftware/dotter/blob/11ec72325e76c3329a58545526940c1df5328a2d/source/dotter/orm.d#L320
Yeah, that doesn't look too
On 09/13/2015 07:16 PM, Daniel N wrote:
>
> Could you try this?
>
> int opCmp(Foo rhs)
> {
> return (id > rhs.id) - (id < rhs.id);
> }
That's not the point, opCmp requires twice as many comparisons as needed
for <. If they are more expansive, e.g. string comparison, your trick
won't work.
On Sunday, 13 September 2015 at 14:06:46 UTC, Martin Nowak wrote:
struct Foo
{
size_t id;
int opCmp(Foo rhs)
{
if (id < rhs.id) return -1;
if (id == rhs.id) return 0;
else return 1;
}
bool opBinary(string s:"<")(Foo rhs)
{
On Fri, 11 Sep 2015 21:40:58 +0200, Martin Nowak
wrote:
Does anyone have a different idea how to make a nice query language?
db.get!Person.where!(p => p.age > 21 && p.name == "Peter")
Django's approach is, IMO, the cleverest and least magical one while
keeping
On Friday, 11 September 2015 at 23:47:42 UTC, Andrei Alexandrescu
wrote:
1. Use lambdas, which seem to already do what you want:
db.get!Person.filter!(p => p.age > 21 && p.name == "Peter")
The way this'd go, the db.get!Person() call returns an input
range of Person. Presumably introspection
On 12-Sep-2015 23:08, Martin Nowak wrote:
On Friday, 11 September 2015 at 23:47:42 UTC, Andrei Alexandrescu wrote:
1. Use lambdas, which seem to already do what you want:
db.get!Person.filter!(p => p.age > 21 && p.name == "Peter")
The way this'd go, the db.get!Person() call returns an input
On Friday, 11 September 2015 at 23:19:54 UTC, Timon Gehr wrote:
Does anyone have a different idea how to make a nice query
language?
db.get!Person.where!(p => p.age > 21 && p.name == "Peter")
You could give up on operator syntax.
That's what I did in the prototype, p.age.gt(21), but it's
On 09/12/2015 04:08 PM, Martin Nowak wrote:
On Friday, 11 September 2015 at 23:47:42 UTC, Andrei Alexandrescu wrote:
1. Use lambdas, which seem to already do what you want:
db.get!Person.filter!(p => p.age > 21 && p.name == "Peter")
The way this'd go, the db.get!Person() call returns an input
On 2015-09-12 01:47, Andrei Alexandrescu wrote:
There's two canonical ways to do that.
1. Use lambdas, which seem to already do what you want:
db.get!Person.filter!(p => p.age > 21 && p.name == "Peter")
The way this'd go, the db.get!Person() call returns an input range of
Person. Presumably
On 2015-09-11 21:40, Martin Nowak wrote:
I find the reasons for turining down my ER a bit moot.
[Issue 14593 – operator overloading can't be used with expression
templates](https://issues.dlang.org/show_bug.cgi?id=14593)
AFAIK expression templates are the primary choice tom implement SIMD and
On Friday, 11 September 2015 at 19:41:41 UTC, Martin Nowak wrote:
Does anyone have a different idea how to make a nice query
language? db.get!Person.where!(p => p.age > 21 && p.name ==
"Peter")
Do it at runtime?
I find the reasons for turining down my ER a bit moot.
[Issue 14593 – operator overloading can't be used with expression
templates](https://issues.dlang.org/show_bug.cgi?id=14593)
AFAIK expression templates are the primary choice tom implement SIMD and
matrix libraries.
And I still have [this
On Friday, 11 September 2015 at 19:41:41 UTC, Martin Nowak wrote:
Does anyone have a different idea how to make a nice query
language? db.get!Person.where!(p => p.age > 21 && p.name ==
"Peter")
Don't the suggestions for DSLs generally revolve around using
string mixins to use whatever syntax
On 09/11/2015 09:40 PM, Martin Nowak wrote:
I find the reasons for turining down my ER a bit moot.
...
+1.
[Issue 14593 – operator overloading can't be used with expression
templates](https://issues.dlang.org/show_bug.cgi?id=14593)
AFAIK expression templates are the primary choice tom
On Fri, Sep 11, 2015 at 07:47:42PM -0400, Andrei Alexandrescu via Digitalmars-d
wrote:
> On 09/11/2015 03:40 PM, Martin Nowak wrote:
> >I find the reasons for turining down my ER a bit moot.
> >
> >[Issue 14593 – operator overloading can't be used with expression
>
On 09/11/2015 08:03 PM, H. S. Teoh via Digitalmars-d wrote:
Needless to say, I did not have
the patience (nor persistence!) to decipher those error messages; most
of my efforts lay in copying textbook examples from the documentation
and modifying them piece by piece, checking their compilability
On Saturday, 12 September 2015 at 00:27:45 UTC, Andrei
Alexandrescu wrote:
On 09/11/2015 08:03 PM, H. S. Teoh via Digitalmars-d wrote:
Needless to say, I did not have
the patience (nor persistence!) to decipher those error
messages; most
of my efforts lay in copying textbook examples from the
On 09/11/2015 03:40 PM, Martin Nowak wrote:
I find the reasons for turining down my ER a bit moot.
[Issue 14593 – operator overloading can't be used with expression
templates](https://issues.dlang.org/show_bug.cgi?id=14593)
AFAIK expression templates are the primary choice tom implement SIMD
42 matches
Mail list logo