It is kinda confusing, but not that much. I think the main problem is that it isn't intuitive.
One usually expects the *operator==* to be symmetric, and in this case it isn't. Moreover spotting bugs would be even harder. Why don't you simply overload the *operator !=* ? That way I could come up with queries like - (Vocabulary::NAO::numericRating() < RATING ) && ( Vocabulary::NAO::hasTag() != TAG ) - Vishesh Handa On Sun, Jul 25, 2010 at 2:00 AM, Artem Serebriyskiy <[email protected]>wrote: > As for me, it is too confusing. > > > On Sun, Jul 25, 2010 at 12:15 AM, Sebastian Trüg <[email protected]> wrote: > >> Hi guys, >> >> at the Akademy a very good idea came up: using C++ operator overloads to >> construct queries. This is very straight-forward for AndTerm and OrTerm: >> >> term1 && term2 && term3 >> >> term1 || term2 || term3 >> >> But it gets nicer (thanks to Vishesh for the tip): >> >> Vocabulary::NIE::contentCreated() > Query::LiteralTerm( dateTime1 ); >> Vocabulary::NAO::hasTag() == term; >> >> which results in the following ComparisonTerms: >> >> ComparisonTerm( >> Vocabulary::NIE::contentCreated(), >> Query::LiteralTerm( dateTime1 ), >> ComparisonTerm::Greater ); >> >> ComparisonTerm( >> Vocabulary::NAO::hasTag(), >> term, >> ComparisonTerm::Equal ); >> >> So far so good. But now let me give you the idea which I would like some >> feedback on. By interchanging the two parameters of the operator we >> create an inverted ComparisonTerm: >> >> term == Vocabulary::NAO::hasTag(); >> >> will create the following term: >> >> ComparisonTerm( >> Vocabulary::NAO::hasTag(), >> term, >> ComparisonTerm::Equal ).inverted(); >> >> For me this is very convenient. But it might be rather confusing. But >> then again inverted terms are confusing to begin with. >> >> So any opinions? >> >> Cheers, >> Sebastian >> _______________________________________________ >> Nepomuk mailing list >> [email protected] >> https://mail.kde.org/mailman/listinfo/nepomuk >> > > > > -- > Sincerely yours, > Artem > > _______________________________________________ > Nepomuk mailing list > [email protected] > https://mail.kde.org/mailman/listinfo/nepomuk > >
_______________________________________________ Nepomuk mailing list [email protected] https://mail.kde.org/mailman/listinfo/nepomuk
